storybook-tests.yml (1876B)
1 name: "Storybook Tests" 2 on: 3 workflow_dispatch: 4 push: 5 jobs: 6 test: 7 permissions: 8 pull-requests: write 9 packages: read 10 timeout-minutes: 60 11 runs-on: ubuntu-latest 12 steps: 13 - uses: actions/checkout@v4 14 - uses: actions/setup-node@v3 15 with: 16 node-version: "18.x" 17 registry-url: https://npm.pkg.github.com/ 18 - name: Install dependencies 19 run: | 20 npm install 21 npm install concurrently http-server wait-on 22 env: 23 # also other environment variable 24 NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 25 - name: Install Playwright 26 run: npx playwright install chromium firefox --with-deps 27 - name: Build Storybook 28 run: | 29 export NODE_OPTIONS="--max_old_space_size=4096" 30 npm run build-storybook --quiet 31 - name: Serve Storybook and run tests 32 run: | 33 export NODE_OPTIONS="--max_old_space_size=4096 --experimental-vm-modules" 34 npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ 35 "npx http-server storybook-static --port 6006" \ 36 "echo \"Starting test\" && npx wait-on -l tcp:127.0.0.1:6006 && npm run test-storybook -- --coverage --browsers firefox chromium" 37 - name: Build lcov.info 38 run: npx nyc report --reporter=lcov -t coverage/storybook --report-dir coverage/storybook 39 - name: Setup LCOV 40 uses: hrishikesh-kadam/setup-lcov@v1 41 - name: Report code coverage 42 uses: zgosalvez/github-actions-report-lcov@v3 43 with: 44 coverage-files: coverage/storybook/lcov.info 45 # TODO: We want to later on reach 80-90% coverage but for now we allow any coverage 46 #minimum-coverage: 90 47 artifact-name: code-coverage-report 48 github-token: ${{ secrets.GITHUB_TOKEN }} 49 update-comment: true