From 15d936c6a72728cdf97297db75a7810898c09787 Mon Sep 17 00:00:00 2001 From: Ruben Carvalho Date: Thu, 25 Jan 2024 16:24:54 +0100 Subject: [PATCH 1/2] feat: Use shared visual regression tests workflow --- .github/workflows/visual-regression.yml | 56 +++---------------------- 1 file changed, 6 insertions(+), 50 deletions(-) diff --git a/.github/workflows/visual-regression.yml b/.github/workflows/visual-regression.yml index c41854e7..3c42db5d 100644 --- a/.github/workflows/visual-regression.yml +++ b/.github/workflows/visual-regression.yml @@ -1,4 +1,4 @@ -name: Visual Regressions +name: Visual Regressions Test on: pull_request: @@ -8,53 +8,9 @@ on: branches: - main -env: - VISUAL_REGRESSION_SNAPSHOT_DIRECTORY: '__image_snapshots__' - jobs: - test: - name: Run Tests - runs-on: ubuntu-latest - 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 }} - update: - name: Update Snapshots - runs-on: ubuntu-latest - if: github.event.ref == 'refs/heads/main' - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'npm' - - run: npm install - - run: npm run build - - run: npm run test:visual:update - - uses: actions/upload-artifact@v3 - with: - name: visual-regression-snapshots - path: ${{ env.VISUAL_REGRESSION_SNAPSHOT_DIRECTORY }} + visual-regression: + uses: cloudscape-design/actions/.github/workflows/visual-regression.yml@main + with: + repository: ${{ github.repository }} + secrets: inherit From b4b08f44b4a49064b4bcf1bc7513b437f99e9a11 Mon Sep 17 00:00:00 2001 From: Ruben Carvalho Date: Thu, 25 Jan 2024 23:23:01 +0100 Subject: [PATCH 2/2] chore: Rename workflow --- .github/workflows/visual-regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual-regression.yml b/.github/workflows/visual-regression.yml index 3c42db5d..e6dadbaa 100644 --- a/.github/workflows/visual-regression.yml +++ b/.github/workflows/visual-regression.yml @@ -1,4 +1,4 @@ -name: Visual Regressions Test +name: Visual Regressions on: pull_request: