Skip to content

Commit

Permalink
Don't try to fetch visual regression snapshots for first run in remo
Browse files Browse the repository at this point in the history
  • Loading branch information
gethinwebster committed Jun 12, 2024
1 parent bfe3611 commit 9b26cbb
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/visual-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main

env:
VISUAL_REGRESSION_SNAPSHOT_DIRECTORY: '__image_snapshots__'
VISUAL_REGRESSION_SNAPSHOT_DIRECTORY: "__image_snapshots__"

jobs:
test:
Expand All @@ -18,29 +18,29 @@ jobs:
if: github.event.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: "Download artifacts"
# Turns out you can not use artifacts from a previous workflow run.
# I'm reluctant to check in the resulting screenshots into the repository,
# which is why we use the following hack, until it's solved on Github side:
# https://github.com/actions/download-artifact/issues/3
run: |
RUN_ID=`gh run --repo $GITHUB_REPOSITORY --branch main list --workflow "Visual Regressions" --json databaseId --jq .[0].databaseId`
echo "Downloading snapshots created in run ${RUN_ID}"
gh run --repo $GITHUB_REPOSITORY download ${RUN_ID} -n "visual-regression-snapshots" -D ${{ env.VISUAL_REGRESSION_SNAPSHOT_DIRECTORY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm install
- run: npm run build
- run: npm run test:visual
- uses: actions/upload-artifact@v3
if: always()
with:
name: visual-regression-snapshots-results
path: ${{ env.VISUAL_REGRESSION_SNAPSHOT_DIRECTORY }}
# - uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: 'npm'
# - name: "Download artifacts"
# # Turns out you can not use artifacts from a previous workflow run.
# # I'm reluctant to check in the resulting screenshots into the repository,
# # which is why we use the following hack, until it's solved on Github side:
# # https://github.com/actions/download-artifact/issues/3
# run: |
# RUN_ID=`gh run --repo $GITHUB_REPOSITORY --branch main list --workflow "Visual Regressions" --json databaseId --jq .[0].databaseId`
# echo "Downloading snapshots created in run ${RUN_ID}"
# gh run --repo $GITHUB_REPOSITORY download ${RUN_ID} -n "visual-regression-snapshots" -D ${{ env.VISUAL_REGRESSION_SNAPSHOT_DIRECTORY }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - run: npm install
# - run: npm run build
# - run: npm run test:visual
# - uses: actions/upload-artifact@v3
# if: always()
# with:
# name: visual-regression-snapshots-results
# path: ${{ env.VISUAL_REGRESSION_SNAPSHOT_DIRECTORY }}
update:
name: Update Snapshots
runs-on: ubuntu-latest
Expand All @@ -50,7 +50,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache: "npm"
- run: npm install
- run: npm run build
- run: npm run test:visual:update
Expand Down

0 comments on commit 9b26cbb

Please sign in to comment.