Skip to content

Commit 049a265

Browse files
committed
Docker PR build
1 parent 7b5e389 commit 049a265

28 files changed

Lines changed: 423 additions & 33 deletions

.github/workflows/docker_pr.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Docker CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**/*.md'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
build_browser:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python 3.13
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.13'
22+
- name: Use Node.js
23+
uses: actions/setup-node@v5
24+
with:
25+
node-version: 24.x
26+
cache: 'npm'
27+
- name: Install python dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install uv
31+
uv pip install wheel --python 3.13 --system --verbose
32+
uv pip install -r Browser/dev-requirements.txt --python 3.13 --system
33+
uv pip install -r pyproject.toml --python 3.13 --system
34+
inv deps
35+
- name: Build proto
36+
run: |
37+
inv protobuf
38+
- name: Build
39+
run: |
40+
inv build
41+
- name: Build the wheel
42+
run: |
43+
inv create-package
44+
- name: Upload Browser wheel
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: browser-wheel
48+
path: dist/*.whl
49+
- name: Create demo app
50+
run: |
51+
inv demo-app
52+
- name: Pack demo app
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: demoapp
56+
path: zip_results/demoapp
57+
58+
docker_image:
59+
runs-on: ubuntu-latest
60+
needs: build_browser
61+
permissions: write-all
62+
steps:
63+
- uses: actions/checkout@v5
64+
- uses: actions/setup-python@v6
65+
with:
66+
python-version: "3.14"
67+
cache: 'pip'
68+
- name: Docker meta
69+
id: meta
70+
uses: docker/metadata-action@v5
71+
with:
72+
images: ghcr.io/marketsquare/robotframework-browser/rfbrowser
73+
tags: |
74+
type=raw,value=tidii
75+
- name: Download browser wheel
76+
uses: actions/download-artifact@v5
77+
with:
78+
name: browser-wheel
79+
path: docker/dist
80+
- name: Login to GitHub Container Registry
81+
uses: docker/login-action@v3
82+
with:
83+
registry: ghcr.io
84+
username: ${{ github.actor }}
85+
password: ${{ secrets.GITHUB_TOKEN }}
86+
- name: Build with GitHub Packages
87+
uses: docker/build-push-action@v6
88+
with:
89+
context: .
90+
file: docker/Dockerfile.dev_pr
91+
tags: tidii
92+
labels: ${{ steps.meta.outputs.labels }}
93+
push: false
94+
- name: Download demo app
95+
uses: actions/download-artifact@v5
96+
with:
97+
name: demoapp
98+
path: demoapp
99+
- name: unzip demo app
100+
run: |
101+
rm -rf node
102+
ls -l demoapp
103+
unzip demoapp/demo-app*.zip -d .
104+
ls -l node
105+
- name: Start demo app and run tests with docker image
106+
run: |
107+
pip install uv
108+
uv pip install invoke robotframework-ghareports --python 3.14 --system
109+
invoke run-test-app-no-build --asynchronous
110+
docker run -v ./atest/:/home/pwuser/test -t tidii:latest bash -c "robot -v SERVER:172.17.0.1:7272 --exclude no-docker-pr -L debug --outputdir /home/pwuser/output /home/pwuser/test"
111+
inv docker-copy-output
112+
- name: Github Job Summary
113+
if: ${{ always() }}
114+
run: |
115+
python -m GHAReports --robotlog output_docker/output.xml
116+
python -m GHAReports --robotlog output_docker/output.xml --markdown fail.md --no-totals --no-passes --no-skipped --fails --no-warnings
117+
cat fail.md

.github/workflows/on-push.yml

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ jobs:
354354
inv demo-app
355355
- uses: actions/upload-artifact@v4
356356
with:
357-
name: demoapp--bb-test-${{ matrix.os }}
357+
name: demoapp-bb-test-${{ matrix.os }}
358358
path: zip_results/demoapp
359359
if-no-files-found: error
360360
- name: Create Distributable BrowserBatteries Package
@@ -389,22 +389,22 @@ jobs:
389389
uses: actions/setup-node@v6
390390
with:
391391
node-version: "22.x"
392-
- name: Download rfbrowser-wheel for BrowserBatteries tests
392+
- name: Download browser-wheel
393393
uses: actions/download-artifact@v5
394394
with:
395395
name: rfbrowser-wheel-bb-test
396396
path: rfbrowser-wheel
397-
- name: Download BrowserBatteries wheels
397+
- name: Download BrowserBatteries wheel
398398
uses: actions/download-artifact@v5
399399
with:
400400
name: browser-batteries-wheels-bb-test-${{ matrix.os }}
401401
path: browser-batteries-wheels
402-
- name: Download demoapp wheels
402+
- name: Download demoapp
403403
uses: actions/download-artifact@v5
404404
with:
405-
name: demoapp--bb-test-${{ matrix.os }}
405+
name: demoapp-bb-test-${{ matrix.os }}
406406
path: demoapp
407-
- name: Install Browser and BrowserBatteries on ${{ matrix.os }}
407+
- name: Install Browser and BrowserBatteries
408408
run: |
409409
python -m pip install --upgrade pip
410410
pip install rfbrowser-wheel/robotframework_browser-*-py3-none-any.whl
@@ -422,7 +422,7 @@ jobs:
422422
ls -l demoapp
423423
unzip demoapp/demo-app*.zip -d .
424424
- name: Run tests on Linux with packed demoapp
425-
if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
425+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
426426
run: |
427427
xvfb-run --auto-servernum invoke atest-robot --smoke
428428
- name: Run tests on MacOS with packed demoapp
@@ -440,3 +440,64 @@ jobs:
440440
python -m GHAReports --robotlog atest/output/output.xml
441441
python -m GHAReports --robotlog atest/output/output.xml --markdown fail.md --no-totals --no-passes --no-skipped --fails --no-warnings
442442
cat fail.md
443+
444+
docker_image:
445+
runs-on: ubuntu-latest
446+
needs: build_browser_batteries_wheels
447+
permissions: write-all
448+
steps:
449+
- uses: actions/checkout@v5
450+
- uses: actions/setup-python@v6
451+
with:
452+
python-version: "3.14"
453+
cache: 'pip'
454+
- name: Docker meta
455+
id: meta
456+
uses: docker/metadata-action@v5
457+
with:
458+
images: ghcr.io/marketsquare/robotframework-browser/rfbrowser
459+
tags: |
460+
type=raw,value=tidii
461+
- name: Download browser wheel
462+
uses: actions/download-artifact@v5
463+
with:
464+
name: rfbrowser-wheel-bb-test
465+
path: docker/dist
466+
- name: Login to GitHub Container Registry
467+
uses: docker/login-action@v3
468+
with:
469+
registry: ghcr.io
470+
username: ${{ github.actor }}
471+
password: ${{ secrets.GITHUB_TOKEN }}
472+
- name: Build with GitHub Packages
473+
uses: docker/build-push-action@v6
474+
with:
475+
context: .
476+
file: docker/Dockerfile.dev_pr
477+
tags: tidii
478+
labels: ${{ steps.meta.outputs.labels }}
479+
push: false
480+
- name: Download demo app
481+
uses: actions/download-artifact@v5
482+
with:
483+
name: demoapp-bb-test-ubuntu-latest
484+
path: demoapp
485+
- name: unzip demo app
486+
run: |
487+
rm -rf node
488+
ls -l demoapp
489+
unzip demoapp/demo-app*.zip -d .
490+
ls -l node
491+
- name: Start demo app and run tests with docker image
492+
run: |
493+
pip install uv
494+
uv pip install invoke robotframework-ghareports --python 3.14 --system
495+
invoke run-test-app-no-build --asynchronous
496+
docker run -v ./atest/:/home/pwuser/test -t tidii:latest bash -c "robot -v SERVER:172.17.0.1:7272 --exclude no-docker-pr -L debug --outputdir /home/pwuser/output /home/pwuser/test"
497+
inv docker-copy-output
498+
- name: Github Job Summary
499+
if: ${{ always() }}
500+
run: |
501+
python -m GHAReports --robotlog output_docker/output.xml
502+
python -m GHAReports --robotlog output_docker/output.xml --markdown fail.md --no-totals --no-passes --no-skipped --fails --no-warnings
503+
cat fail.md

.github/workflows/on-release.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,102 @@ jobs:
266266
twine check dist/*
267267
- name: Publish BrowserBatteries distribution to PyPI
268268
uses: pypa/gh-action-pypi-publish@release/v1
269+
270+
docker-image:
271+
needs: publish-browser-to-pypi
272+
runs-on: ubuntu-latest
273+
steps:
274+
- uses: actions/checkout@v5
275+
- name: Set up QEMU for cross-platforms builds
276+
uses: docker/setup-qemu-action@v3
277+
- name: Set up Docker Buildx
278+
uses: docker/setup-buildx-action@v3
279+
280+
- name: Login to Docker Hub
281+
uses: docker/login-action@v3
282+
with:
283+
username: ${{ secrets.DOCKER_USERNAME }}
284+
password: ${{ secrets.DOCKER_TOKEN }}
285+
286+
- name: Docker meta
287+
id: meta
288+
uses: docker/metadata-action@v5
289+
with:
290+
images: marketsquare/robotframework-browser
291+
tags: |
292+
type=ref,event=branch
293+
type=semver,pattern={{version}}
294+
type=semver,pattern={{major}}.{{minor}}
295+
type=semver,pattern={{major}}
296+
flavor: |
297+
latest=true
298+
299+
- name: Push tag :version_number to Docker Hub
300+
uses: docker/build-push-action@v6
301+
with:
302+
tags: ${{ steps.meta.outputs.tags }}
303+
file: docker/Dockerfile.latest_release
304+
platforms: linux/arm64/v8,linux/amd64
305+
push: ${{ github.event_name != 'push' }}
306+
307+
- name: Docker meta
308+
id: meta_github
309+
uses: docker/metadata-action@v5
310+
with:
311+
images: ghcr.io/marketsquare/robotframework-browser/rfbrowser-stable
312+
tags: |
313+
type=ref,event=branch
314+
type=semver,pattern={{version}}
315+
type=semver,pattern={{major}}.{{minor}}
316+
type=semver,pattern={{major}}
317+
flavor: |
318+
latest=true
319+
320+
- name: Login to GitHub Container Registry
321+
uses: docker/login-action@v3
322+
with:
323+
registry: ghcr.io
324+
username: ${{ github.actor }}
325+
password: ${{ secrets.GITHUB_TOKEN }}
326+
327+
- name: Push to GitHub Packages
328+
uses: docker/build-push-action@v6
329+
with:
330+
platforms: linux/arm64/v8,linux/amd64
331+
file: docker/Dockerfile.latest_release
332+
tags: ${{ steps.meta_github.outputs.tags }}
333+
push: ${{ github.event_name != 'push' }}
334+
335+
test-docker-image:
336+
needs: docker-image
337+
runs-on: ubuntu-latest
338+
steps:
339+
- uses: actions/checkout@v5
340+
- name: Set up Python 3.11
341+
uses: actions/setup-python@v6
342+
with:
343+
python-version: 3.11
344+
cache: 'pip'
345+
- name: Install python dependencies
346+
run: |
347+
python -m pip install --upgrade pip
348+
pip install uv
349+
uv pip install wheel --python 3.11 --system
350+
uv pip install -r Browser/dev-requirements.txt --python 3.11 --system
351+
- name: Install invoke deps
352+
run: |
353+
invoke deps
354+
- name: build testing docker image
355+
run: |
356+
invoke docker-tester
357+
- name: set permissions
358+
run: chmod -R 777 atest/
359+
- name: Run tests with latest stable docker image
360+
# continue on error until all docker tests pass
361+
run: |
362+
invoke docker-test
363+
- uses: actions/upload-artifact@v4
364+
if: ${{ always() }}
365+
with:
366+
name: Docker test results
367+
path: atest/output

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ __pycache__
2222
robotframework_browser.egg-info/
2323
.venv
2424
zip_results
25+
mypy_stub
2526

2627
# utest
2728
utest/output

atest/test/01_Browser_Management/chromiun_channel.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Resource imports.resource
33

44
Suite Teardown Close Browser ALL
55

6+
Test Tags no-docker-pr
7+
68
*** Test Cases ***
79
Wrong Browser With Channel
810
Run Keyword And Expect Error

atest/test/01_Browser_Management/client_certificates.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Suite Setup Setup
66
Suite Teardown Suite Teardown
77
Test Teardown Close Browser ALL
88

9+
Test Tags no-docker-pr
10+
911
*** Test Cases ***
1012
Open Browser With Client Certificate
1113
New Browser browser=${BROWSER} headless=${HEADLESS}

atest/test/01_Browser_Management/geolocation.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ Force Tags no-iframe
2121

2222
*** Test Cases ***
2323
Set Geolocation On Browser Startup
24+
[Tags] no-docker-pr
2425
Start Context With Geolocation
2526
Check Geolocation 42 -42.42
2627

2728
Set Geolocation
29+
[Tags] no-docker-pr
2830
[Setup] Start Context With Geolocation
2931
Set Geolocation 72.56 145.89 0.23
3032
Check Geolocation 72.56 145.89
3133

3234
Enable Geolocation
35+
[Tags] no-docker-pr
3336
[Setup] Start Context Without Geolocation
3437
Set Browser Timeout timeout=500ms scope=Test
3538
Set Geolocation 11.11 22.22 33.33

0 commit comments

Comments
 (0)