-
Notifications
You must be signed in to change notification settings - Fork 158
159 lines (140 loc) · 4.6 KB
/
e2e-tests-parallel.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
name: e2e-tests-parallel
on:
push:
branches: [ main, release/v2*, feat/* ]
pull_request:
branches: [ main, release/v2*, feat/* ]
concurrency:
group: e2e-tests-parallel${{ github.ref }}
cancel-in-progress: true
jobs:
install-web-components:
strategy:
matrix:
os: [ macos-latest ]
node-version: [ 18.x ]
browser: [ chromium ]
runs-on: ${{ matrix.os }}
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- uses: actions/cache@v4
name: Download any existing cache
id: yarn-cache
with:
path: |
**/node_modules
/Users/runner/Library/Caches/Cypress
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
- name: Installing dependencies (if not cached)
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable --immutable-cache
- name: Build project
run: yarn lerna run --stream --ignore @carbon/ibmdotcom-react build
- name: Set Cloud Masthead env var
uses: ./.github/actions/set-dotenv
with:
env-file: packages/web-components/.env
env:
C4D_CLOUD_MASTHEAD: true
C4D_FLAGS_ALL: true
- name: Build storybook
working-directory: packages/web-components
run: yarn build-storybook
- name: Save build folder
uses: actions/upload-artifact@v4
with:
name: storybook-build
path: packages/web-components/storybook-static
- name: Clear remnant failure files
uses: geekyeggo/delete-artifact@v5
with:
name: failure-wc.txt
web-components-tests:
runs-on: macos-latest
needs: install-web-components
continue-on-error: true
strategy:
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: [1, 2, 3, 4, 5, 6, 7]
os: [ macos-latest ]
node-version: [ 18.x ]
browser: [ chromium ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Download the build folders
uses: actions/download-artifact@v4
with:
name: storybook-build
path: packages/web-components/storybook-static
- uses: actions/cache@v4
name: Retrieve yarn cache
id: yarn-cache
with:
path: |
**/node_modules
/Users/runner/Library/Caches/Cypress
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
- name: 'Run e2e tests (chromium)'
if: matrix.browser == 'chromium'
id: cypress-tests-wc
continue-on-error: true
working-directory: packages/web-components
run: |
export CYPRESS_VERIFY_TIMEOUT=60000
yarn cypress:verify
yarn test:e2e-storybook:test:parallel
env:
CI_BUILD_ID: '${{ github.sha }}-${{ github.workflow }}-wc'
CYPRESS_API_URL: "https://sorry-cypress-director.qfl95m0zv01.us-east.codeengine.appdomain.cloud"
CYPRESS_CACHE_FOLDER: /Users/runner/Library/Caches/Cypress
- name: Create failure file if job failed
id: wc-no-tests-ran
if: steps.cypress-tests-wc.outcome == 'failure'
run: touch failure-wc.txt
- name: Save failure file
if: steps.cypress-tests-wc.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: failure-wc
path: failure-wc.txt
- name: Exit upon failure
if: steps.cypress-tests-wc.outcome == 'failure'
run: exit 1
wc-tests-completed:
if: always()
runs-on: ubuntu-20.04
needs: web-components-tests
steps:
- uses: actions/download-artifact@v4
continue-on-error: true
with:
name: failure-wc
- name: Check failure file existence
continue-on-error: true
id: check_files
uses: andstor/file-existence-action@v3
with:
files: "failure-wc.txt"
- name: Failure file exists, exit with error
if: steps.check_files.outputs.files_exists == 'true'
run: exit 1