-
Notifications
You must be signed in to change notification settings - Fork 32
195 lines (162 loc) · 6.15 KB
/
e2e.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: e2e
on:
push:
branches:
- '**'
- '!**--skip-ci'
- '!**--visual-reports'
- '!wip/**'
- '!experiments/**'
- '!release'
- '!portal'
- '!beta'
- '!alpha'
pull_request:
branches:
- 'main'
types: [opened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GH_EMAIL: ${{ secrets.GH_EMAIL }}
GH_NAME: ${{ secrets.GH_NAME }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }}
FIGMA_ICONS_FILE: ${{ secrets.FIGMA_ICONS_FILE }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
RUN_POST_BUILD: ${{ startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/v') }}
jobs:
visual-test:
name: Run visual e2e-tests
runs-on: macos-15
timeout-minutes: 40
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Use yarn cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ./.yarn/cache
key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-deps-
- name: Install dependencies
run: yarn install --immutable
- name: Use Playwright cache
uses: actions/cache@v4
id: playwright-cache
with:
path: |
~/Library/Caches/ms-playwright
~/.cache/ms-playwright
%USERPROFILE%\AppData\Local\ms-playwright
key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-playwright-${{ hashFiles('**/yarn.lock') }}
- run: yarn workspace @dnb/eufemia playwright install --with-deps firefox
if: steps.playwright-cache.outputs.cache-hit != 'true'
- run: yarn workspace @dnb/eufemia playwright install-deps firefox
if: steps.playwright-cache.outputs.cache-hit == 'true'
- name: Prebuild Library
if: env.RUN_POST_BUILD == 'true'
run: yarn workspace @dnb/eufemia prebuild:ci
- name: Postbuild Library
if: env.RUN_POST_BUILD == 'true'
run: yarn workspace @dnb/eufemia postbuild:ci
- name: Build portal
run: yarn workspace dnb-design-system-portal build:visual-test
- name: Run visual tests
run: yarn workspace dnb-design-system-portal test:screenshots:ci
- uses: actions/upload-artifact@v4
if: failure()
with:
name: visual-test-artifact
path: |
./packages/dnb-eufemia/src/**/*.snap-diff.png
./packages/dnb-eufemia/jest-visual-diff-report/*
- name: Run visual tests info
if: failure()
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'
- name: Slack
uses: 8398a7/action-slack@v3
with:
channel: '#eufemia-dev'
status: ${{ job.status }}
fields: author,ref,workflow,job,took
job_name: Run visual e2e-tests
github_base_url: https://github.com/
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
if: ${{ always() && !github.event.pull_request.head.repo.fork }}
continue-on-error: true
portal-test:
name: Run portal e2e-tests
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Use node_modules cache
uses: actions/cache@v4
id: modules-cache
with:
path: '**/node_modules'
key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-modules-
- name: Install dependencies
run: yarn install --immutable
- name: Use Playwright cache
uses: actions/cache@v4
id: playwright-cache
with:
path: |
~/Library/Caches/ms-playwright
~/.cache/ms-playwright
%USERPROFILE%\AppData\Local\ms-playwright
key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-playwright-${{ hashFiles('**/yarn.lock') }}
- run: yarn workspace dnb-design-system-portal playwright install --with-deps firefox
if: steps.playwright-cache.outputs.cache-hit != 'true'
- run: yarn workspace dnb-design-system-portal playwright install-deps firefox
if: steps.playwright-cache.outputs.cache-hit == 'true'
- name: Prebuild Library
run: yarn workspace @dnb/eufemia prebuild:ci
- name: Postbuild Library
run: yarn workspace @dnb/eufemia postbuild:ci
- name: Build portal
run: yarn workspace dnb-design-system-portal build
- name: Run Playwright on Portal
run: yarn workspace dnb-design-system-portal test:e2e:portal:ci
- name: Run Playwright on Eufemia Components
run: yarn workspace @dnb/eufemia test:e2e:ci
- name: Store Playwright artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-develop-artifact
path: |
./packages/dnb-design-system-portal/test-results
./packages/dnb-design-system-portal/playwright-report
- name: Slack
uses: 8398a7/action-slack@v3
with:
channel: '#eufemia-dev'
status: ${{ job.status }}
fields: author,ref,workflow,job,took
job_name: Run portal e2e-tests
github_base_url: https://github.com/
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
if: ${{ always() && !github.event.pull_request.head.repo.fork }}
continue-on-error: true