ci: add story test report #278
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, next] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| # install, build, upload artefacts and run tests | |
| ci: | |
| name: Install & Testing | |
| runs-on: ubuntu-latest | |
| container: | |
| image: mcr.microsoft.com/playwright:v1.52.0-noble | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.11' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn --immutable | |
| - name: Build packages | |
| run: yarn hje:dist; yarn rje:dist | |
| - name: Build docs | |
| run: yarn docs:dist | |
| # run unit tests | |
| - name: Run unit tests | |
| run: yarn test:ci | |
| - name: Configure Git safe directory | |
| run: git config --global --add safe.directory $GITHUB_WORKSPACE | |
| - uses: dorny/test-reporter@v1.6.0 | |
| with: | |
| name: unit test results | |
| path: junit.xml | |
| reporter: jest-junit | |
| # run story tests | |
| - name: Serve Storybook and run tests | |
| run: | | |
| npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | |
| "npx http-server dist/docs --port 6006 --silent" \ | |
| "npx wait-on tcp:6006 && yarn test:stories:ci" | |
| - uses: dorny/test-reporter@v1.6.0 | |
| if: always() # run even if tests fail | |
| with: | |
| name: storybook test results | |
| path: storybook-test-results.xml | |
| reporter: jest-junit | |
| # upload docs | |
| - name: Upload docs | |
| id: deployment | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dist/docs | |
| # publish docs | |
| docs_publish: | |
| if: github.ref_name == github.event.repository.default_branch | |
| needs: ci | |
| name: Publish Docs | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |