generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
283 lines (233 loc) · 7.78 KB
/
cross-environment-tests.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: Cross Environment Tests
on:
push:
branches:
- main
- '*'
pull_request:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test-node-web5:
strategy:
fail-fast: false
matrix:
node-version: [20, 18]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout web5-js
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
path: web5-js
- name: Checkout bundler-bonanza
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
repository: TBD54566975/bundler-bonanza
path: bundler-bonanza
- name: 📦 Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: ⚙️ Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- name: build web5-js
run: |
cd web5-js
pnpm install
pnpm build
- name: 📥 Install dependencies
run: |
cd bundler-bonanza
npm install --save ../web5-js/packages/api
pnpm install --no-frozen-lockfile
- name: 🧪 Run Web5 tests
run: cd bundler-bonanza && pnpm test:web5
# reference: https://github.com/remarkablemark/react-native-cli-quickstart/blob/master/.github/workflows/e2e-ios.yml
test-rn-ios:
timeout-minutes: 60
runs-on: macos-latest
defaults:
run:
working-directory: ./tests/reactnative
steps:
- name: Checkout web5-js
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
path: web5-js
- name: Checkout bundler-bonanza
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
repository: TBD54566975/bundler-bonanza
path: bundler-bonanza
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: yarn
node-version: 18
cache-dependency-path: ./bundler-bonanza/tests/reactnative/yarn.lock
- name: build web5-js
run: |
cd web5-js
pnpm install
pnpm build
- name: 📥 Install dependencies
run: |
cd bundler-bonanza
npm install --save ../web5-js/packages/api
yarn --prefer-offline
- name: Install macOS dependencies
run: |
brew tap wix/brew
brew install applesimutils
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Restore CocoaPods
id: restore-cocoapods
uses: actions/cache/restore@v3
with:
path: bundler-bonanza/tests/reactnative/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('bundler-bonanza/tests/reactnative/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install CocoaPods
run: NO_FLIPPER=1 cd bundler-bonanza/ios && pod install
- name: Save CocoaPods
uses: actions/cache/save@v3
if: success()
id: save-cocoapods
with:
path: bundler-bonanza/tests/reactnative/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('bundler-bonanza/tests/reactnative/ios/Podfile.lock') }}
- name: Restore Detox build
id: restore-detox-build
uses: actions/cache/restore@v3
with:
path: bundler-bonanza/tests/reactnative/ios/build
key: ${{ runner.os }}-detox-${{ hashFiles('bundler-bonanza/tests/reactnative/ios/Podfile.lock') }}
- name: Detox build
if: steps.restore-detox-build.outputs.cache-hit != 'true'
run: cd bundler-bonanza && yarn detox build --configuration ios.sim.debug
- name: Save Detox Build
uses: actions/cache/save@v3
if: success()
id: save-detox-build
with:
path: bundler-bonanza/tests/reactnative/ios/build
key: ${{ runner.os }}-detox-${{ hashFiles('bundler-bonanza/tests/reactnative/ios/Podfile.lock') }}
- name: Run tests
run: cd bundler-bonanza && yarn test
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-rn-ios-detox-artifacts
path: bundler-bonanza/tests/reactnative/artifacts
test-browsers:
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
browser:
[
"desktop-safari",
"desktop-chrome",
"desktop-firefox",
"desktop-edge",
"mobile-safari",
"mobile-chrome",
]
runs-on: ubuntu-latest
steps:
- name: Checkout web5-js
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
path: web5-js
- name: Checkout bundler-bonanza
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
repository: TBD54566975/bundler-bonanza
path: bundler-bonanza
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
run: npm install -g pnpm
- name: build web5-js
run: |
cd web5-js
pnpm install
pnpm build
- name: 📥 Install dependencies
run: |
cd bundler-bonanza
npm install --save ../web5-js/packages/api
pnpm install --no-frozen-lockfile
- name: Install Playwright Browsers
run: pnpm playwright install --with-deps
- name: Run browser tests
run: cd bundler-bonanza && TEST_PARAMS="--project=${{ matrix.browser }} --trace=on" pnpm test:browser
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: bundler-bonanza/playwright-report/
retention-days: 30
test-electron:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./bundler-bonanza/tests/electron-vite
steps:
- name: Checkout web5-js
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
path: web5-js
- name: build web5-js
run: |
cd web5-js
pnpm install
pnpm build
- name: Checkout bundler-bonanza
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
repository: TBD54566975/bundler-bonanza
path: bundler-bonanza
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
cache-dependency-path: ./bundler-bonanza/tests/electron-vite/yarn.lock
- name: 📥 Install dependencies
run: |
cd bundler-bonanza
npm install --save ../web5-js/packages/api
yarn --prefer-offline
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- name: Build electron app
run: cd bundler-bonanza && yarn build
- name: Run electron tests
run: cd bundler-bonanza && yarn test --trace=on
if: matrix.os != 'ubuntu-latest'
- name: Run electron tests (xvfb)
run: cd bundler-bonanza && xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test --trace=on
if: matrix.os == 'ubuntu-latest'
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: bundler-bonanza/tests/electron-vite/playwright-report/
retention-days: 30