Skip to content

Commit aadfb40

Browse files
committed
Docker PR build
1 parent c6fbd67 commit aadfb40

File tree

4 files changed

+144
-8
lines changed

4 files changed

+144
-8
lines changed

.github/workflows/docker_pr.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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:
62+
contents: read
63+
packages: write
64+
steps:
65+
- uses: actions/checkout@v5
66+
- name: Login to GitHub Container Registry
67+
uses: docker/login-action@v3
68+
with:
69+
registry: ghcr.io
70+
username: ${{ github.actor }}
71+
password: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Docker meta
74+
id: meta
75+
uses: docker/metadata-action@v5
76+
with:
77+
images: ghcr.io/marketsquare/robotframework-browser/rfbrowser-dev
78+
- name: Download browser wheel
79+
uses: actions/download-artifact@v5
80+
with:
81+
name: browser-wheel
82+
path: docker/dist
83+
- name: Debug ls
84+
run: |
85+
ls -l docker/dist
86+
echo ===========================
87+
ls -l docker
88+
echo ===========================
89+
pwd
90+
- name: Push to GitHub Packages
91+
uses: docker/build-push-action@v6
92+
with:
93+
context: .
94+
file: docker/Dockerfile.dev_pr
95+
tags: ${{ steps.meta.outputs.tags }}
96+
labels: ${{ steps.meta.outputs.labels }}
97+
push: true

.github/workflows/on-push.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,22 +388,22 @@ jobs:
388388
uses: actions/setup-node@v5
389389
with:
390390
node-version: "22.x"
391-
- name: Download rfbrowser-wheel for BrowserBatteries tests
391+
- name: Download browser-wheel
392392
uses: actions/download-artifact@v5
393393
with:
394394
name: rfbrowser-wheel-bb-test
395395
path: rfbrowser-wheel
396-
- name: Download BrowserBatteries wheels
396+
- name: Download BrowserBatteries wheel
397397
uses: actions/download-artifact@v5
398398
with:
399399
name: browser-batteries-wheels-bb-test-${{ matrix.os }}
400400
path: browser-batteries-wheels
401-
- name: Download demoapp wheels
401+
- name: Download demoapp
402402
uses: actions/download-artifact@v5
403403
with:
404404
name: demoapp--bb-test-${{ matrix.os }}
405405
path: demoapp
406-
- name: Install Browser and BrowserBatteries on ${{ matrix.os }}
406+
- name: Install Browser and BrowserBatteries
407407
run: |
408408
python -m pip install --upgrade pip
409409
pip install rfbrowser-wheel/robotframework_browser-*-py3-none-any.whl
@@ -421,7 +421,7 @@ jobs:
421421
ls -l demoapp
422422
unzip demoapp/demo-app*.zip -d .
423423
- name: Run tests on Linux with packed demoapp
424-
if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
424+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
425425
run: |
426426
xvfb-run --auto-servernum invoke atest-robot --smoke
427427
- name: Run tests on MacOS with packed demoapp

docker/Dockerfile.dev_pr

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM mcr.microsoft.com/playwright:v1.55.1-noble
2+
3+
# Update apt-get
4+
USER root
5+
RUN apt-get update
6+
RUN python3 --version
7+
RUN apt install -y python3-pip python3.12-venv
8+
9+
# Clean up
10+
USER root
11+
RUN apt-get clean && \
12+
rm -rf /var/lib/apt/lists/*
13+
14+
# Set environment variables
15+
ENV PATH="/home/pwuser/.local/bin:${PATH}"
16+
ENV NODE_PATH=/usr/lib/node_modules
17+
18+
# Cache operations
19+
USER root
20+
RUN mv /root/.cache/ /home/pwuser/.cache || true
21+
RUN chmod a+rwx -R /home/pwuser/.cache || true
22+
23+
# Switch to pwuser for the remaining operations
24+
USER pwuser
25+
26+
# Create venv and active it
27+
RUN python3 -m venv /home/pwuser/.venv
28+
ENV PATH="/home/pwuser/.venv/bin:$PATH"
29+
30+
# Upgrade pip and wheel for the user
31+
RUN pip3 install --no-cache-dir --upgrade pip wheel uv
32+
33+
# Copy the dist files
34+
COPY docker/dist/*.whl /home/pwuser/
35+
# Install RobotFramework and Browser library
36+
RUN uv pip install --no-cache-dir --upgrade robotframework && \
37+
uv pip install --no-cache-dir /home/pwuser/robotframework_browser-*.whl && \
38+
rm /home/pwuser/*.whl
39+
40+
# Initialize Browser library without browsers binaries
41+
RUN python3 -m Browser.entry init --skip-browsers

tasks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,9 +865,7 @@ def package_nodejs(c: Context, architecture=None):
865865
print(f"Current os platform: {_os_platform}")
866866
_os_platform = _os_platform.replace("-", "_").replace(".", "_").replace(" ", "_")
867867
if _os_platform.startswith("macosx") and platform.machine().lower() == "x86_64":
868-
_os_platform = _os_platform.replace(
869-
"universal2", platform.machine().lower()
870-
)
868+
_os_platform = _os_platform.replace("universal2", platform.machine().lower())
871869
elif sysconfig.get_platform().lower() == "linux-x86_64":
872870
_os_platform = f"manylinux_2_17_{architecture}"
873871
elif sysconfig.get_platform().lower() == "linux-aarch64":

0 commit comments

Comments
 (0)