File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,12 +76,24 @@ jobs:
7676 steps :
7777 - uses : actions/checkout@v4
7878
79+ - name : Checkout CustomPiOS
80+ uses : actions/checkout@v4
81+ with :
82+ repository : ' guysoft/CustomPiOS'
83+ path : CustomPiOS
84+
7985 - name : Download arm64 image from build
8086 uses : actions/download-artifact@v4
8187 with :
8288 name : octopi-arm64
8389 path : image/
8490
91+ - name : Prepare testing context
92+ run : |
93+ mkdir -p testing/custompios
94+ cp -r CustomPiOS/src/distro_testing/scripts testing/custompios/scripts
95+ cp -r CustomPiOS/src/distro_testing/tests testing/custompios/tests
96+
8597 - name : Build test Docker image
8698 run : DOCKER_BUILDKIT=0 docker build -t octopi-e2e-test ./testing/
8799
94106 -v "$PWD/artifacts:/output" \
95107 -v "$(realpath $IMG):/input/image.img:ro" \
96108 -e ARTIFACTS_DIR=/output \
109+ -e DISTRO_NAME="OctoPi" \
97110 -e KEEP_ALIVE=true \
98111 octopi-e2e-test
99112
Original file line number Diff line number Diff line change 11images /
2+ custompios /
3+ * .png
Original file line number Diff line number Diff line change @@ -2,10 +2,19 @@ FROM ptrsr/pi-ci:latest
22
33ENV LIBGUESTFS_BACKEND=direct
44
5- RUN apt-get update && apt-get install -y --no-install-recommends sshpass openssh-client curl && rm -rf /var/lib/apt/lists/*
5+ RUN apt-get update && apt-get install -y --no-install-recommends \
6+ sshpass openssh-client curl socat imagemagick \
7+ && rm -rf /var/lib/apt/lists/*
68
7- COPY scripts/ /test/scripts/
9+ # Shared framework from CustomPiOS (copied into build context by CI)
10+ COPY custompios/scripts/ /test/scripts/
11+ COPY custompios/tests/ /test/tests/
12+
13+ # OctoPi-specific tests and hooks
814COPY tests/ /test/tests/
9- RUN chmod +x /test/scripts/*.sh /test/tests/*.sh
15+ COPY hooks/ /test/hooks/
16+
17+ RUN chmod +x /test/scripts/*.sh /test/tests/*.sh; \
18+ chmod +x /test/hooks/*.sh 2>/dev/null || true
1019
1120ENTRYPOINT ["/test/scripts/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+ IMAGE_FILE=" ${1:? Usage: $0 <image.qcow2>} "
4+
5+ export LIBGUESTFS_BACKEND=direct
6+ export LIBGUESTFS_DEBUG=0
7+ export LIBGUESTFS_TRACE=0
8+
9+ echo ' === OctoPi-specific image patches ==='
10+
11+ echo ' Downloading haproxy config for IPv4 patching...'
12+ guestfish -a " $IMAGE_FILE " << GFEOF
13+ run
14+ mount /dev/sda2 /
15+ download /etc/haproxy/haproxy.cfg /tmp/haproxy.cfg
16+ umount /
17+ GFEOF
18+
19+ echo ' Fixing haproxy for IPv4-only (QEMU has no IPv6)...'
20+ sed -i ' s/bind :::80 v4v6/bind *:80/' /tmp/haproxy.cfg
21+ sed -i ' s/bind :::443 v4v6/bind *:443/' /tmp/haproxy.cfg
22+
23+ guestfish -a " $IMAGE_FILE " << GFEOF2
24+ run
25+ mount /dev/sda2 /
26+ upload /tmp/haproxy.cfg /etc/haproxy/haproxy.cfg
27+ umount /
28+ GFEOF2
29+
30+ echo ' OctoPi patches applied'
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+ SSH_HOST=" ${1:- localhost} "
4+ SSH_PORT=" ${2:- 2222} "
5+ ARTIFACTS_DIR=" ${3:-/ output} "
6+
7+ SSH_CMD=" sshpass -p raspberry ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=password -o PubkeyAuthentication=no -o LogLevel=ERROR -p $SSH_PORT ${SSH_HOST} "
8+
9+ echo " Capturing OctoPrint web UI artifacts..."
10+
11+ # Save rendered HTML via curl through SSH (inside the guest, hitting localhost:80)
12+ BODY=$( ${SSH_CMD} -l pi " curl -s http://localhost" 2> /dev/null || echo " " )
13+
14+ if [ -n " $BODY " ]; then
15+ echo " $BODY " > " $ARTIFACTS_DIR /octoprint-ui.html"
16+ echo " Saved OctoPrint HTML to artifacts"
17+ fi
18+
19+ # Attempt headless screenshot from inside the container if a browser is available
20+ HTTP_PORT=" ${QEMU_HTTP_PORT:- 8080} "
21+ for BROWSER in chromium chromium-browser google-chrome; do
22+ if command -v " $BROWSER " & > /dev/null; then
23+ echo " Using $BROWSER for headless screenshot..."
24+ " $BROWSER " --headless --disable-gpu --no-sandbox \
25+ --virtual-time-budget=10000 \
26+ --screenshot=" $ARTIFACTS_DIR /screenshot.png" \
27+ --window-size=1280,720 \
28+ " http://localhost:${HTTP_PORT} " 2> /dev/null || true
29+ if [ -f " $ARTIFACTS_DIR /screenshot.png" ]; then
30+ echo " Browser screenshot saved"
31+ exit 0
32+ fi
33+ fi
34+ done
35+
36+ echo " No headless browser available in container (HTML artifact saved instead)"
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments