diff --git a/.github/actions/test-build-package/action.yml b/.github/actions/test-build-package/action.yml new file mode 100644 index 00000000..e53b76d0 --- /dev/null +++ b/.github/actions/test-build-package/action.yml @@ -0,0 +1,21 @@ +name: Test build package + +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 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/actions/test-build/action.yml b/.github/actions/test-build/action.yml index 69ea6441..edaa9b4b 100644 --- a/.github/actions/test-build/action.yml +++ b/.github/actions/test-build/action.yml @@ -1,4 +1,4 @@ -name: Test build +name: Test build Storybook on: workflow_call: @@ -16,9 +16,3 @@ runs: - 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 bfc2c598..32051ea8 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -42,13 +42,23 @@ jobs: - check steps: - uses: actions/checkout@v3 - - name: Test build + - name: Test build Storybook uses: ./.github/actions/test-build + test-build-package: + runs-on: ubuntu-latest + needs: + - check + steps: + - uses: actions/checkout@v3 + - name: Test build package + uses: ./.github/actions/test-build-package + prototype-kit: runs-on: ubuntu-latest needs: - test-build + - test-build-package steps: - uses: actions/checkout@v3 - name: GOV.UK prototype kit test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0924cdc5..d545aa8f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,13 +24,21 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Tests + - name: Test build Storybook uses: ./.github/actions/test-build + test-build-package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Test build package + uses: ./.github/actions/test-build-package + prototype-kit: runs-on: ubuntu-latest needs: - test-build + - test-build-package steps: - uses: actions/checkout@v3 - name: GOV.UK prototype kit test