File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 uses : actions/checkout@v4
2929 with :
3030 repository : ' guysoft/CustomPiOS'
31+ ref : feature/e2e
3132 path : CustomPiOS
3233
3334 - name : Checkout Project Repository
@@ -76,12 +77,25 @@ jobs:
7677 steps :
7778 - uses : actions/checkout@v4
7879
80+ - name : Checkout CustomPiOS
81+ uses : actions/checkout@v4
82+ with :
83+ repository : ' guysoft/CustomPiOS'
84+ ref : feature/e2e
85+ path : CustomPiOS
86+
7987 - name : Download arm64 image from build
8088 uses : actions/download-artifact@v4
8189 with :
8290 name : octopi-arm64
8391 path : image/
8492
93+ - name : Prepare testing context
94+ run : |
95+ mkdir -p testing/custompios
96+ cp -r CustomPiOS/src/distro_testing/scripts testing/custompios/scripts
97+ cp -r CustomPiOS/src/distro_testing/tests testing/custompios/tests
98+
8599 - name : Build test Docker image
86100 run : DOCKER_BUILDKIT=0 docker build -t octopi-e2e-test ./testing/
87101
94108 -v "$PWD/artifacts:/output" \
95109 -v "$(realpath $IMG):/input/image.img:ro" \
96110 -e ARTIFACTS_DIR=/output \
111+ -e DISTRO_NAME="OctoPi" \
97112 -e KEEP_ALIVE=true \
98113 octopi-e2e-test
99114
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