Submit screenshots to Percy for visual regression testing. #108
Workflow file for this run
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: Submit screenshots to Percy for visual regression testing. | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
inputs: {} | |
jobs: | |
percy: | |
name: Percy - Nuxt3.x Site | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/workflows/setup-workspace | |
- name: Cache built static site | |
id: cache-nuxt3 | |
uses: actions/cache@v3 | |
with: | |
path: .output/public | |
key: nuxt3-site-${{ github.sha }} | |
- name: Sets env vars for PR preview | |
run: | | |
echo "ES_ALIAS=${{secrets.ES_ALIAS_TEST}}-percy-tests-${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV | |
if: github.ref_name!='main' | |
- name: Sets env vars for nuxt3.x merge | |
run: | | |
echo "ES_ALIAS=${{secrets.ES_ALIAS_TEST}}" >> $GITHUB_ENV | |
if: github.ref_name=='main' | |
- run: pnpm run generate | |
if: steps.cache-nuxt3.outputs.cache-hit != 'true' | |
env: | |
CRAFT_ENDPOINT: ${{ secrets.CRAFT_ENDPOINT_TEST }} | |
S3_BUCKET: "https://static.library.ucla.edu/" | |
ES_URL: ${{ secrets.ES_URL }} | |
ESApiKey: ${{ secrets.ESApiKey }} | |
ES_READ_KEY: ${{ secrets.ES_READ_KEY_TEST }} | |
ES_WRITE_KEY: ${{ secrets.ES_WRITE_KEY_TEST }} | |
ES_ALIAS: ${{ env.ES_ALIAS }} | |
ES_INDEX_PREFIX: ${{secrets.ES_INDEX_PREFIX_TEST}} | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: cypress-io/github-action@v3 | |
with: | |
start: pnpm dlx serve .output/public | |
install: false | |
command-prefix: 'percy exec -- pnpx' | |
wait-on: http://localhost:3000 | |
wait-on-timeout: 110 | |
env: | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_E2E }} |