diff --git a/.github/actions/prototype-kit-test/action.yml b/.github/actions/prototype-kit-test/action.yml index 5e61dcb3..f4b95a8b 100644 --- a/.github/actions/prototype-kit-test/action.yml +++ b/.github/actions/prototype-kit-test/action.yml @@ -1,4 +1,4 @@ -name: GOV.UK prototype kit +name: GOV.UK prototype kit test on: workflow_call: @@ -19,9 +19,6 @@ runs: cd package && npm pack --pack-destination . shell: bash - - name: Test package - run: node tasks/test-package.js || exit 1 - shell: bash - name: Create prototype run: > mkdir prototype && diff --git a/.github/actions/test-build/action.yml b/.github/actions/test-build/action.yml new file mode 100644 index 00000000..69ea6441 --- /dev/null +++ b/.github/actions/test-build/action.yml @@ -0,0 +1,24 @@ +name: Test build + +on: + workflow_call: + +runs: + using: "composite" + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + - name: Install dependencies + run: npm ci + shell: bash + - name: Build Storybook + run: npm run build + shell: bash + - name: Build package + run: ./tasks/build-package.sh + shell: bash + - name: Test built package + run: node tasks/test-package.js || exit 1 + shell: bash diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 3c9ff080..bfc2c598 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -24,7 +24,8 @@ jobs: - check steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/lint + - name: Lint + uses: ./.github/actions/lint tests: runs-on: ubuntu-latest @@ -32,15 +33,26 @@ jobs: - check steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/tests + - name: Tests + uses: ./.github/actions/tests - prototype-kit: + test-build: runs-on: ubuntu-latest needs: - check steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/prototype-kit-test + - name: Test build + uses: ./.github/actions/test-build + + prototype-kit: + runs-on: ubuntu-latest + needs: + - test-build + steps: + - uses: actions/checkout@v3 + - name: GOV.UK prototype kit test + uses: ./.github/actions/prototype-kit-test publish-npm: name: Build package and publish to npm diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 20a7a2d2..0924cdc5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,19 +10,28 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/lint - + - name: Lint + uses: ./.github/actions/lint + tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/tests + - name: Tests + uses: ./.github/actions/tests + + test-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Tests + uses: ./.github/actions/test-build prototype-kit: runs-on: ubuntu-latest needs: - - lint - - tests + - test-build steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/prototype-kit-test + - name: GOV.UK prototype kit test + uses: ./.github/actions/prototype-kit-test