chore: Pin dependencies and use explicit immutable installs (#795) #546
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: Visual Regression Tests | |
| on: | |
| push: | |
| branches: [main] | |
| # Allow updating snapshots during manual runs | |
| workflow_call: | |
| inputs: | |
| update-snapshots: | |
| description: 'Update snapshots?' | |
| type: boolean | |
| # Allow updating snapshots during automatic runs | |
| workflow_dispatch: | |
| inputs: | |
| update-snapshots: | |
| description: 'Update snapshots?' | |
| type: boolean | |
| env: | |
| NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
| CI: true | |
| jobs: | |
| test: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22.x' | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Install Playwright Browsers | |
| run: yarn playwright install | |
| - name: Build Storybook | |
| run: | | |
| yarn build:storybook | |
| - name: Set up cache | |
| id: cache | |
| uses: actions/cache@v4 | |
| with: | |
| key: cache/${{github.repository}}/${{github.ref}} | |
| restore-keys: cache/${{github.repository}}/refs/heads/main | |
| path: .visual-test/** | |
| - name: Initialize snapshots | |
| if: ${{steps.cache.outputs.cache-hit != 'true' || inputs.update-snapshots == true}} | |
| run: npx playwright test --update-snapshots --reporter html | |
| - name: Run Playwright tests | |
| run: yarn playwright test | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: .visual-test/spec/results/ | |
| retention-days: 30 | |
| overwrite: true |