Support snapshots in pipeline #15
This file contains 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: Run tests | |
concurrency: | |
group: ${{github.ref}}/${{github.workflow}} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
workflow_call: | |
inputs: | |
update-snapshots: | |
description: "Update snapshots?" | |
type: boolean | |
workflow_dispatch: | |
inputs: | |
update-snapshots: | |
description: "Update snapshots?" | |
type: boolean | |
env: | |
BROWSERCAT_API_KEY: ${{secrets.BROWSERCAT_API_KEY}} | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up PNPM | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
cache: pnpm | |
node-version-file: .nvmrc | |
check-latest: true | |
- name: Install deps | |
run: | | |
pnpm install --frozen-lockfile | |
- name: Set up cache | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
key: cache/${{github.repository}}/${{github.ref}} | |
restore-keys: cache/${{github.repository}}/refs/heads/master | |
path: .test/** | |
- name: Initialize snapshots | |
if: ${{steps.cache.outputs.cache-hit != 'true' || inputs.update-snapshots == 'true'}} | |
run: | | |
pnpm run test:bcat --update-snapshots | |
- name: Test | |
continue-on-error: true | |
run: | | |
pnpm run test:bcat | |
- name: Upload test report | |
id: report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report | |
path: .test/spec/results/ | |
retention-days: 30 | |
overwrite: true |