chore(release): 5.1.0 #68
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: Playwright Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| test: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: | |
| - "lts/*" | |
| browser: | |
| - "chromium" | |
| - "firefox" | |
| - "webkit" | |
| name: Node ${{ matrix.node-version }} (${{ matrix.browser }}) tests | |
| env: | |
| WORKING_DIRECTORY: ${{ github.workspace }} | |
| CI: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "npm" | |
| - name: Set short git commit SHA | |
| id: vars | |
| run: | | |
| calculatedSha=$(git rev-parse --short ${{ github.sha }}) | |
| echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | |
| # See https://dev.to/ayomiku222/how-to-cache-playwright-browser-on-github-actions-51o6 | |
| - name: Cache playwright binaries | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: | | |
| ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ env.COMMIT_SHORT_SHA }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright Browsers | |
| run: npx playwright install | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| - name: Install Playwright additional dependencies (for WebKit) | |
| run: npx playwright install-deps | |
| if: matrix.browser == 'webkit' | |
| - name: Generate mock audit report for Node v10 ~ v14 (default options) | |
| run: cat ${{ github.workspace }}/.playwright/fixtures/npm-audit-node-v10.json | node ./src/index.js --path ${{ github.workspace }}/npm-audit-node-v10.html --title playwright-test | |
| - name: Generate mock audit report for Node v16 ~ lts (default options) | |
| run: cat ${{ github.workspace }}/.playwright/fixtures/npm-audit-node-v16.json | node ./src/index.js --path ${{ github.workspace }}/npm-audit-node-v16.html --title playwright-test | |
| - name: Generate mock audit report for pnpm v10 (default options) | |
| run: cat ${{ github.workspace }}/.playwright/fixtures/pnpm-audit-v10.json | node ./src/index.js --path ${{ github.workspace }}/pnpm-audit-v10.html --title playwright-test | |
| - name: Generate mock audit report for yarn (default options) | |
| run: cat ${{ github.workspace }}/.playwright/fixtures/yarn-audit.jsonl | node ./src/index.js --path ${{ github.workspace }}/yarn-audit.html --title playwright-test | |
| - name: Generate mock audit report for bun (default options) | |
| run: cat ${{ github.workspace }}/.playwright/fixtures/bun-audit.json | node ./src/index.js --path ${{ github.workspace }}/bun-audit.html --title playwright-test | |
| - name: Run Playwright tests for ${{ matrix.browser }} | |
| env: | |
| WEB_BROWSER: ${{ matrix.browser }} | |
| run: npx playwright test | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report-nodejs-v${{ matrix.node-version }} | |
| path: playwright-report/nodejs-v${{ matrix.node-version }} | |
| retention-days: 15 | |
| overwrite: true |