-
Notifications
You must be signed in to change notification settings - Fork 106
307 lines (303 loc) · 9.96 KB
/
on-push.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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Continuous integration
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '15 10 * * *'
env:
SYS_VAR_CI_INSTALL_TEST: 0
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ "ubuntu-latest", "windows-latest" ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install nodejs dependencies
env:
PLAYWRIGHT_BROWSERS_PATH: 0
run: |
npm ci
npx playwright install --with-deps
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'
- name: Install python dependencies in Linux
if: matrix.os == 'ubuntu-latest'
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install wheel --python 3.11 --system --verbose
uv pip install -r Browser/dev-requirements.txt --python 3.11 --system
- name: Install python dependencies in Windows
if: matrix.os != 'ubuntu-latest'
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install wheel --python 3.11 --system --verbose
uv pip install -r Browser/dev-requirements.txt --python 3.11 --system
- name: Build Protos and check with tsc
if: matrix.os == 'ubuntu-latest'
run: |
inv node-build
python -m Browser.gen_stub
- name: Build test app
run: |
inv create-test-app
- name: Create Distributable Package
if: matrix.os == 'ubuntu-latest'
run: |
inv docs
inv create-package
- uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: rfbrowser-wheel
path: dist/robotframework_browser-*-py3-none-any.whl
- name: Package demoapp
run: |
inv demo-app
- uses: actions/upload-artifact@v4
with:
name: demoapp-${{ matrix.os }}
path: zip_results/demoapp
testing:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read
pull-requests: write
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
python-version: "3.10"
node-version: 18.x
shard: 1
- os: windows-latest
python-version: "3.12"
node-version: 20.x
shard: 2
- os: ubuntu-latest
python-version: "3.10"
node-version: 22.x
shard: 3
- os: ubuntu-latest
python-version: "3.11"
node-version: 20.x
shard: 4
- os: windows-latest
python-version: "3.9"
node-version: 20.x
shard: 1
- os: ubuntu-latest
python-version: "3.10"
node-version: 18.x
shard: 2
- os: ubuntu-latest
python-version: "3.9"
node-version: 18.x
shard: 3
- os: ubuntu-latest
python-version: "3.10"
node-version: 20.x
shard: 4
- os: ubuntu-latest
python-version: "3.11"
node-version: 20.x
shard: 1
- os: macos-latest
python-version: "3.11"
node-version: 20.x
shard: 1
- os: macos-latest
python-version: "3.12"
node-version: 20.x
shard: 2
- os: macos-latest
python-version: "3.10"
node-version: 20.x
shard: 3
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install nodejs dependencies
env:
PLAYWRIGHT_BROWSERS_PATH: 0
run: |
npm ci
npx playwright install --with-deps
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install wheel --python ${{ matrix.python-version }} --system
uv pip install -r Browser/dev-requirements.txt --python ${{ matrix.python-version }} --system
- name: Build Protos and check with tsc
run: |
inv node-build
python -m Browser.gen_stub
- name: Check types with mypy on Linux
if: matrix.os == 'ubuntu-latest' && matrix.shard == 1 && matrix.python-version != '3.10'
run: |
inv lint-python
- name: Lint atest
if: matrix.shard == 1
run: |
inv lint-robot
- name: Lint node
if: matrix.shard == 1
run: |
inv lint-node
- name: Build test app
run: |
inv create-test-app
- name: Start xvfb on Linux
if: matrix.os == 'ubuntu-latest'
run: |
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
- name: Run pytests
if: matrix.shard == 1
run: |
invoke utest
- name: Run Robot Framework tests on linux
if: matrix.os == 'ubuntu-latest'
run: |
xvfb-run --auto-servernum inv atest --shard ${{ matrix.shard }}/4 -z true
- name: Run Robot Framework tests on Windows
if: matrix.os == 'windows-latest'
run: |
inv atest --shard ${{ matrix.shard }}/4 -z true
- name: Run Robot Framework tests on macOS
if: matrix.os == 'macos-latest'
run: |
inv atest --shard ${{ matrix.shard }}/4 -z true
- name: Install rflogs
if: always()
run: |
pip install rflogs
- name: Upload test results to RF Logs
if: always()
env:
RFLOGS_API_KEY: ${{ secrets.RFLOGS_API_KEY }}
working-directory: ${{ github.workspace }}/atest/output
run: |
rflogs upload --tag branch:${{ github.head_ref || github.ref_name }} --tag shard:${{ matrix.shard }} --tag os:${{ matrix.os }} --tag python-version:${{ matrix.python-version }} --tag node-version:${{ matrix.node-version }} || true
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: Test results-${{ matrix.os }}-${{ matrix.shard }}-${{ matrix.python-version }}-${{ matrix.node-version }}
path: zip_results/output
test-install:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
python-version: [3.9, 3.11]
node-version: [18.x, 20.x]
exclude:
- python-version: 3.9
node-version: 20.x
- os: windows-latest
python-version: 3.9
- os: windows-latest
node-version: 20.x
steps:
- uses: actions/checkout@v4
- name: Download package for install testing
uses: actions/download-artifact@v4
with:
name: rfbrowser-wheel
- name: Download package for install testing
uses: actions/download-artifact@v4
with:
name: demoapp-${{ matrix.os }}
path: zip_results/demoapp
- name: Unzip demoapp in linux or MacOS
if: matrix.os != 'windows-latest'
run: |
ls -l zip_results/demoapp
unzip -o zip_results/demoapp/demo-app-linux.zip
- name: Unzip demoapp in windows
if: matrix.os == 'windows-latest'
run: |
dir zip_results/demoapp
tar -xf zip_results/demoapp/demo-app-win32.zip
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Robot Framework Browser on unix-like
run: |
pip install uv
uv pip install ./robotframework_browser-*-py3-none-any.whl --python ${{ matrix.python-version }} --system
if: matrix.os != 'windows-latest'
- name: Install Robot Framework Browser on windows
run: |
pip install uv
uv pip install (gci *.whl)--python ${{ matrix.python-version }} --system
if: matrix.os == 'windows-latest'
- name: Install node deps and python deps for test running
run: |
rfbrowser init
uv pip install wheel --python ${{ matrix.python-version }} --system
uv pip install -r Browser/dev-requirements.txt --python ${{ matrix.python-version }} --system
- name: Test on unix-like os - serial mode
if: matrix.os == 'ubuntu-latest'
env:
SYS_VAR_CI_INSTALL_TEST: 1
run: |
echo ${{ matrix.os }}
rm -rf Browser
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &
xvfb-run --auto-servernum invoke atest-robot --smoke
- name: Run Robot Framework tests on windows or macOS
if: ${{ matrix.os != 'ubuntu-latest' }}
env:
SYS_VAR_CI_INSTALL_TEST: 1
run: |
echo ${{ matrix.os }}
Remove-Item -Path .\Browser -Force -Recurse
invoke atest-robot --smoke
- name: Uninstall on Linux or MacOS
if: ${{ matrix.os != 'windows-latest' }}
run: |
rfbrowser clean-node
uv pip uninstall robotframework-browser --python ${{ matrix.python-version }} --system
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.node-version }} Clean install results
path: atest/output