-
Notifications
You must be signed in to change notification settings - Fork 143
673 lines (659 loc) · 23.2 KB
/
Copy pathon-push.yml
File metadata and controls
673 lines (659 loc) · 23.2 KB
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
# 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 ]
paths-ignore:
- '**/*.md'
pull_request:
branches: [ main ]
schedule:
- cron: '15 10 * * *'
env:
SYS_VAR_CI_INSTALL_TEST: 0
jobs:
# The version the wheels of this run carry. Empty unless this is a push to
# main, which keeps pull request and scheduled runs building exactly the
# versions they build today.
nightly_version:
name: Work out the nightly version
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
version: ${{ steps.dev.outputs.version }}
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.13
uses: actions/setup-python@v7
with:
python-version: "3.13"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install invoke --python 3.13 --system
- name: Work out the version
id: dev
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
inv dev-version
testing:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read
pull-requests: write
strategy:
fail-fast: false
# The lowest rf-version below is the supported Robot Framework floor and must
# match the robotframework lower bound in pyproject.toml. Change both together.
matrix:
include:
- os: windows-latest
python-version: "3.10"
node-version: 22.x
shard: 1
rf-version: "7.4.2"
- os: windows-latest
python-version: "3.12"
node-version: 24.x
shard: 2
rf-version: "7.1.1"
- os: ubuntu-latest
python-version: "3.14"
node-version: 22.x
shard: 3
rf-version: "7.4.2"
- os: ubuntu-latest
python-version: "3.11"
node-version: 26.x
shard: 4
rf-version: "7.1.1"
- os: windows-latest
python-version: "3.14"
node-version: 24.x
shard: 1
rf-version: "7.4.2"
- os: ubuntu-latest
python-version: "3.10"
node-version: 22.x
shard: 2
rf-version: "7.1.1"
- os: ubuntu-latest
python-version: "3.13"
node-version: 22.x
shard: 3
rf-version: "7.1.1"
- os: ubuntu-latest
python-version: "3.10"
node-version: 24.x
shard: 4
rf-version: "7.1.1"
- os: ubuntu-latest
python-version: "3.14"
node-version: 22.x
shard: 1
rf-version: "7.4.2"
- os: macos-latest
python-version: "3.11"
node-version: 24.x
shard: 1
rf-version: "7.4.2"
- os: macos-latest
python-version: "3.14"
node-version: 24.x
shard: 2
rf-version: "7.1.1"
- os: macos-latest
python-version: "3.10"
node-version: 22.x
shard: 3
rf-version: "7.4.2"
steps:
- uses: actions/checkout@v7
- name: Use Node.js
uses: actions/setup-node@v7
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@v7
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
uv pip install -r pyproject.toml --python ${{ matrix.python-version }} --system
uv pip install robotframework==${{ matrix.rf-version }} --python ${{ matrix.python-version }} --system
python atest/library/os_wrapper.py
- name: Build stubs
run: |
inv node-build
- 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 &
# Shard 1 is pinned to the latest Robot Framework, so the extra condition is what runs
# the unit tests against the supported floor as well. Keep one entry of each rf-version.
- name: Run pytests
if: matrix.shard == 1 || (matrix.rf-version == '7.1.1' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13')
run: |
invoke utest
- name: Run Node.js unit tests with coverage
if: matrix.shard == 1
run: |
npm run test:coverage
node node/coverage-summary.mjs
- uses: actions/upload-artifact@v7
if: matrix.shard == 1
with:
name: node-coverage-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.node-version }}
path: node/coverage/
- name: Run Robot Framework tests on linux
if: matrix.os == 'ubuntu-latest'
run: |
xvfb-run --auto-servernum inv atest --shard ${{ matrix.shard }}/4
- name: Run Robot Framework tests on Windows
if: matrix.os == 'windows-latest'
run: |
inv atest --shard ${{ matrix.shard }}/4
- name: Run Robot Framework tests on macOS
if: matrix.os == 'macos-latest'
run: |
inv atest --shard ${{ matrix.shard }}/4
- uses: actions/upload-artifact@v7
if: ${{ always() }}
with:
name: Test results-${{ matrix.os }}-${{ matrix.shard }}-${{ matrix.python-version }}-${{ matrix.node-version }}
path: atest/output
- name: Github Job Summary
if: ${{ always() }}
run: |
python -m GHAReports --robotlog atest/output/output.xml --markdown fail.md --no-totals --no-passes --no-skipped --fails --no-warnings
cat fail.md
build:
runs-on: ${{ matrix.os }}
needs: nightly_version
strategy:
matrix:
os: [ "ubuntu-latest", "windows-latest" ]
steps:
- uses: actions/checkout@v7
- name: Use Node.js
uses: actions/setup-node@v7
with:
node-version: 24.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.12
uses: actions/setup-python@v7
with:
python-version: 3.12
cache: 'pip'
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install wheel --python 3.12 --system --verbose
uv pip install -r Browser/dev-requirements.txt --python 3.12 --system
uv pip install -r pyproject.toml --python 3.12 --system
# A nightly wheel has to say which build it is, and the version has to be
# stamped before packaging rather than renamed afterwards, because it also
# goes into the metadata and into the BrowserBatteries dependency pin.
- name: Stamp the nightly version
if: needs.nightly_version.outputs.version != ''
run: |
inv version ${{ needs.nightly_version.outputs.version }}
- name: Build stubs
if: matrix.os == 'ubuntu-latest'
run: |
inv node-build
- 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@v7
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@v7
with:
name: demoapp-${{ matrix.os }}
path: zip_results/demoapp
test-install:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
python-version: ["3.10", "3.13"]
node-version: [22.x, 24.x]
exclude:
- python-version: "3.10"
node-version: 22.x
- os: windows-latest
python-version: "3.10"
- os: windows-latest
node-version: 22.x
steps:
- uses: actions/checkout@v7
- name: Download package for install testing
uses: actions/download-artifact@v8
with:
name: rfbrowser-wheel
- name: Download package for install testing
uses: actions/download-artifact@v8
with:
name: demoapp-${{ matrix.os }}
path: zip_results/demoapp
- name: Unzip demoapp in *nix like
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@v7
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Robot Framework Browser on *nix 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 Ubuntu - serial mode
if: matrix.os == 'ubuntu-latest'
env:
SYS_VAR_CI_INSTALL_TEST: 1
run: |
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: |
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@v7
if: ${{ always() }}
with:
name: ${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.node-version }} Clean install results
path: atest/output
- name: Github Job Summary
if: ${{ always() }}
run: |
python -m GHAReports --robotlog atest/output/output.xml --markdown fail.md --no-totals --no-passes --no-skipped --fails --no-warnings
cat fail.md
build_browser_batteries_wheels:
name: Build wheels on ${{ matrix.os }} for BrowserBatteries tests
runs-on: ${{ matrix.os }}
needs: nightly_version
timeout-minutes: 45
env:
# This job only builds wheels, no need to download Playwright browsers
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-24.04-arm
- windows-latest
- macos-15-intel
- macos-latest
steps:
- uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: "24.x"
cache: 'npm'
- name: Setup Python 3.13
uses: actions/setup-python@v7
with:
python-version: "3.13"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv pip install wheel invoke --python 3.13 --system --verbose
python -c "import sys;print(sys.platform)"
python -c "import sysconfig;print(sysconfig.get_platform())"
python -c "import platform;print(platform.machine().lower())"
inv deps
- name: Stamp the nightly version
if: needs.nightly_version.outputs.version != ''
run: |
inv version ${{ needs.nightly_version.outputs.version }}
- name: Build stubs
if: matrix.os == 'ubuntu-latest'
run: |
inv node-build
- name: Create Distributable Browser Package
if: matrix.os == 'ubuntu-latest'
run: |
inv create-package
- uses: actions/upload-artifact@v7
name: Upload rfbrowser-wheel for BrowserBatteries tests
if: matrix.os == 'ubuntu-latest'
with:
name: rfbrowser-wheel-bb-test
path: dist/robotframework_browser-*-py3-none-any.whl
if-no-files-found: error
- name: Build test app
run: |
inv create-test-app
- name: Package demoapp
run: |
inv demo-app
- uses: actions/upload-artifact@v7
with:
name: demoapp-bb-test-${{ matrix.os }}
path: zip_results/demoapp
if-no-files-found: error
- name: Create Distributable BrowserBatteries Package
run: |
inv package-nodejs
- uses: actions/upload-artifact@v7
with:
name: browser-batteries-wheels-bb-test-${{ matrix.os }}
path: browser_batteries/dist/robotframework_browser_batteries-*.whl
if-no-files-found: error
test_browser_batteries_wheels:
needs:
- build_browser_batteries_wheels
name: Test wheels on ${{ matrix.os }} for BrowserBatteries tests
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(github.event_name == 'schedule' && '["ubuntu-latest", "ubuntu-24.04-arm", "windows-latest", "macos-15-intel", "macos-latest"]' || '["ubuntu-latest", "ubuntu-24.04-arm", "windows-latest", "macos-latest"]') }}
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.14
uses: actions/setup-python@v7
with:
python-version: 3.14
cache: 'pip'
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: "24.x"
- name: Download browser-wheel
uses: actions/download-artifact@v8
with:
name: rfbrowser-wheel-bb-test
path: rfbrowser-wheel
- name: Download BrowserBatteries wheel
uses: actions/download-artifact@v8
with:
name: browser-batteries-wheels-bb-test-${{ matrix.os }}
path: browser-batteries-wheels
- name: Download demoapp
uses: actions/download-artifact@v8
with:
name: demoapp-bb-test-${{ matrix.os }}
path: demoapp
- name: Install Browser and BrowserBatteries
if: matrix.os != 'windows-latest'
run: |
python -m pip install --upgrade pip
pip install rfbrowser-wheel/robotframework_browser-*-py3-none-any.whl
pip install browser-batteries-wheels/robotframework_browser_batteries-*-py3-none-*.whl
rfbrowser --version
rfbrowser install --with-deps
- name: Install Browser and BrowserBatteries On Windows
if: matrix.os == 'windows-latest'
run: |
python -m pip install --upgrade pip
pip install (Resolve-Path rfbrowser-wheel/robotframework_browser-*-py3-none-any.whl)
pip install (Resolve-Path browser-batteries-wheels/robotframework_browser_batteries-*-py3-none-*.whl)
rfbrowser --version
rfbrowser install
- name: Install test dependencies
run: |
pip install -r Browser/dev-requirements.txt
- name: Unzip demoapp *nix
if: matrix.os != 'windows-latest'
run: |
rm -rf Browser
rm -rf node
rm -rf browser_batteries
ls -l demoapp
unzip demoapp/demo-app*.zip -d .
- name: Unzip demoapp Windows
if: matrix.os == 'windows-latest'
run: |
Remove-Item -Path .\Browser -Force -Recurse
Remove-Item -Path .\node -Force -Recurse
Remove-Item -Path .\browser_batteries -Force -Recurse
dir demoapp
Expand-Archive -Path (Resolve-Path demoapp/demo-app*.zip) -DestinationPath .
- name: Run tests on ${{ matrix.os }} with packed demoapp
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
run: |
xvfb-run --auto-servernum invoke atest-robot --smoke
- name: Run tests on ${{ matrix.os }} with packed demoapp
if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest' || matrix.os == 'macos-15-intel'
run: |
inv atest-robot
- uses: actions/upload-artifact@v7
if: ${{ always() }}
with:
name: Clean_install_results_${{ matrix.os }}
path: atest/output
- name: Github Job Summary
if: ${{ always() }}
run: |
python -m GHAReports --robotlog atest/output/output.xml --markdown fail.md --no-totals --no-passes --no-skipped --fails --no-warnings
cat fail.md
- name: Uninstall
run: |
rfbrowser clean-node
pip uninstall -y robotframework-browser-batteries
pip uninstall -y robotframework-browser
docker_image:
runs-on: ubuntu-latest
needs: build_browser_batteries_wheels
permissions: write-all
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.14"
cache: 'pip'
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/marketsquare/robotframework-browser/rfbrowser
tags: |
type=raw,value=tidii
- name: Download browser wheel
uses: actions/download-artifact@v8
with:
name: rfbrowser-wheel-bb-test
path: docker/dist
- name: Login to GitHub Container Registry
uses: docker/login-action@v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build with GitHub Packages
uses: docker/build-push-action@v7
with:
context: .
file: docker/Dockerfile.dev_pr
tags: tidii
labels: ${{ steps.meta.outputs.labels }}
push: false
- name: Download demo app
uses: actions/download-artifact@v8
with:
name: demoapp-bb-test-ubuntu-latest
path: demoapp
- name: unzip demo app
run: |
rm -rf node
ls -l demoapp
unzip demoapp/demo-app*.zip -d .
ls -l node
- name: Start demo app and run tests with docker image
run: |
pip install uv
uv pip install invoke robotframework-ghareports --python 3.14 --system
set +e
docker run \
-v ./atest/:/home/pwuser/test \
-v ./node/:/home/pwuser/node \
-t tidii:latest \
bash -lc "
node /home/pwuser/node/dynamic-test-app/dist/server.js > /tmp/test-app.log 2>&1 &
app_pid=\$!
for i in \$(seq 1 30); do
if curl --fail --silent --show-error http://localhost:7272/dist/ > /dev/null; then
break
fi
sleep 1
done
if ! curl --fail --silent --show-error http://localhost:7272/dist/ > /dev/null; then
echo 'Test app failed to start inside container.'
cat /tmp/test-app.log
exit 1
fi
robot -v SERVER:localhost:7272 --exclude no-docker-pr -L debug --outputdir /home/pwuser/output /home/pwuser/test
robot_status=\$?
kill \$app_pid || true
wait \$app_pid 2>/dev/null || true
exit \$robot_status
"
docker_status=$?
inv docker-copy-output
copy_status=$?
if [ "$docker_status" -ne 0 ]; then
exit "$docker_status"
fi
exit "$copy_status"
- uses: actions/upload-artifact@v7
if: ${{ always() }}
with:
name: docker_results
path: output_docker
- name: Github Job Summary
if: ${{ always() }}
run: |
python -m GHAReports --robotlog output_docker/output.xml --markdown fail.md --no-totals --no-passes --no-skipped --fails --no-warnings
cat fail.md
# Everything green on main becomes the wheels at
# https://github.com/MarketSquare/robotframework-browser/releases/tag/nightly
# so that a fix can be tried out without waiting for a release. Needs the test
# jobs and not just the build jobs, because untested wheels are worse than no
# wheels: whoever installs them cannot tell our breakage from theirs.
publish_nightly:
name: Publish the nightly wheels
runs-on: ubuntu-latest
timeout-minutes: 15
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- nightly_version
- testing
- build
- test-install
- build_browser_batteries_wheels
- test_browser_batteries_wheels
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: Download the Browser wheel
uses: actions/download-artifact@v8
with:
name: rfbrowser-wheel
path: nightly-wheels
- name: Download the BrowserBatteries wheels
uses: actions/download-artifact@v8
with:
pattern: browser-batteries-wheels-bb-test-*
merge-multiple: true
path: nightly-wheels
- name: Replace the assets on the nightly release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.nightly_version.outputs.version }}
run: |
bash .github/scripts/publish-nightly.sh