Skip to content

Commit 7150800

Browse files
committed
Build Portal before running "Run visual tests"
1 parent 56f5888 commit 7150800

File tree

2 files changed

+30
-46
lines changed

2 files changed

+30
-46
lines changed

.github/workflows/icons-lib.yml

Lines changed: 27 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
process-icons:
2222
name: Fetch and Build Icons
2323

24-
runs-on: ubuntu-latest
24+
runs-on: macos-latest
2525

2626
timeout-minutes: 60
2727

@@ -48,6 +48,20 @@ jobs:
4848
if: steps.modules-cache.outputs.cache-hit != 'true'
4949
run: yarn install --immutable
5050

51+
- name: Use Playwright cache
52+
uses: actions/cache@v4
53+
id: playwright-cache
54+
with:
55+
path: |
56+
~/Library/Caches/ms-playwright
57+
~/.cache/ms-playwright
58+
%USERPROFILE%\AppData\Local\ms-playwright
59+
key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-playwright-${{ hashFiles('**/yarn.lock') }}
60+
- run: yarn workspace @dnb/eufemia playwright install --with-deps firefox
61+
if: steps.playwright-cache.outputs.cache-hit != 'true'
62+
- run: yarn workspace @dnb/eufemia playwright install-deps firefox
63+
if: steps.playwright-cache.outputs.cache-hit == 'true'
64+
5165
- name: Icons fetch and prebuild
5266
run: yarn workspace @dnb/eufemia prebuild:figma:ci
5367

@@ -60,55 +74,22 @@ jobs:
6074
- name: Build portal
6175
run: yarn workspace dnb-design-system-portal build:visual-test
6276

63-
- name: Store portal artifacts
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: portal-build-artifact
67-
path: ./packages/dnb-design-system-portal/public
68-
69-
- name: Commit icons
70-
run: yarn workspace @dnb/eufemia postbuild:commit
71-
72-
visual-test:
73-
needs: process-icons
74-
name: Run visual e2e-test for icons
75-
76-
runs-on: macos-latest
77-
78-
timeout-minutes: 60
79-
80-
steps:
81-
- name: Git checkout
82-
uses: actions/checkout@v4
83-
with:
84-
persist-credentials: false
85-
86-
- name: Use Node.js
87-
uses: actions/setup-node@v4
88-
with:
89-
node-version-file: 'package.json'
90-
91-
- name: Use yarn cache
92-
uses: actions/cache@v4
93-
id: yarn-cache
94-
with:
95-
path: ./.yarn/cache
96-
key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}
97-
restore-keys: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-deps-
98-
99-
- name: Install dependencies
100-
run: yarn install --immutable
77+
- name: Run visual tests
78+
run: yarn workspace dnb-design-system-portal test:screenshots:ci:update
10179

102-
- name: Re-store portal artifacts
103-
uses: actions/download-artifact@v4.1.7
80+
- uses: actions/upload-artifact@v4
81+
if: failure()
10482
with:
105-
name: portal-build-artifact
106-
path: ./packages/dnb-design-system-portal/public
83+
name: visual-test-artifact
84+
path: |
85+
./packages/dnb-eufemia/src/**/*.snap-diff.png
86+
./packages/dnb-eufemia/jest-visual-diff-report/*
10787
108-
- name: Run visual tests
109-
run: yarn workspace dnb-design-system-portal test:screenshots:ci
88+
- name: Run visual tests info
89+
if: failure()
90+
run: echo '\n\n👉 Download the diff files as a ZIP file. \nIt is called "visual-test-artifact" and you find it in the test "Summary" under "Artifacts".\n\n\n'
11091

111-
- name: Commit updated snapshots
92+
- name: Commit icons and updated snapshots
11293
run: yarn workspace @dnb/eufemia postbuild:commit
11394

11495
- name: Slack

.github/workflows/visual-regression.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ env:
3737
ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }}
3838
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
3939
RUN_POST_BUILD: ${{ startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/v') }}
40+
RUN_VISUAL_TEST: ${{ !startsWith(github.ref, 'refs/heads/icon') }}
4041

4142
jobs:
4243
visual-regression:
@@ -91,9 +92,11 @@ jobs:
9192
run: yarn workspace @dnb/eufemia postbuild:ci
9293

9394
- name: Build portal
95+
if: env.RUN_VISUAL_TEST == 'true'
9496
run: yarn workspace dnb-design-system-portal build:visual-test
9597

9698
- name: Run visual tests
99+
if: env.RUN_VISUAL_TEST == 'true'
97100
run: yarn workspace dnb-design-system-portal test:screenshots:ci
98101

99102
- uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)