|
1 | 1 | name: Build Image |
2 | 2 |
|
3 | | -on: push |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + push: |
4 | 6 |
|
5 | 7 | jobs: |
6 | 8 | build: |
7 | 9 | runs-on: ubuntu-latest |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - board: raspberrypiarmhf |
| 15 | + arch: armhf |
| 16 | + - board: raspberrypiarm64 |
| 17 | + arch: arm64 |
8 | 18 | steps: |
9 | | - - name: Update apt |
10 | | - run: sudo apt-get update |
11 | | - - name: Install Dependencies |
12 | | - run: sudo apt install coreutils p7zip-full qemu-user-static python3-git |
13 | | - - name: Checkout CustomPiOS |
14 | | - uses: actions/checkout@v2 |
15 | | - with: |
16 | | - repository: 'guysoft/CustomPiOS' |
17 | | - path: CustomPiOS |
18 | | - - name: Checkout Project Repository |
19 | | - uses: actions/checkout@v2 |
20 | | - with: |
21 | | - repository: ${{ github.repository }} |
22 | | - path: repository |
23 | | - submodules: true |
24 | | - - name: Download Raspbian Image |
25 | | - run: cd repository/src/image && wget -q -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_latest' |
26 | | - - name: Update CustomPiOS Paths |
27 | | - run: cd repository/src && ../../CustomPiOS/src/update-custompios-paths |
28 | | - - name: Build Image |
29 | | - run: sudo modprobe loop && cd repository/src && sudo bash -x ./build_dist |
30 | | - - name: Copy Output |
31 | | - run: cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img build.img |
32 | | - - name: Zip Output |
33 | | - run: gzip build.img |
34 | | - - uses: actions/upload-artifact@v4 |
35 | | - with: |
36 | | - name: build.img.gz |
37 | | - path: build.img.gz |
| 19 | + - name: Install Dependencies |
| 20 | + run: | |
| 21 | + sudo apt-get update |
| 22 | + sudo apt-get install -y coreutils p7zip-full qemu-user-static \ |
| 23 | + python3-git python3-yaml |
| 24 | +
|
| 25 | + - name: Checkout CustomPiOS |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + repository: 'guysoft/CustomPiOS' |
| 29 | + path: CustomPiOS |
| 30 | + |
| 31 | + - name: Checkout Project Repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + path: repository |
| 35 | + submodules: true |
| 36 | + |
| 37 | + - name: Update CustomPiOS Paths |
| 38 | + run: | |
| 39 | + cd repository/src |
| 40 | + ../../CustomPiOS/src/update-custompios-paths |
| 41 | +
|
| 42 | + - name: Download Base Image |
| 43 | + run: | |
| 44 | + cd repository/src |
| 45 | + export DIST_PATH=$(pwd) |
| 46 | + export CUSTOM_PI_OS_PATH=$(cat custompios_path) |
| 47 | + export BASE_BOARD=${{ matrix.board }} |
| 48 | + $CUSTOM_PI_OS_PATH/base_image_downloader_wrapper.sh |
| 49 | +
|
| 50 | + - name: Build Image |
| 51 | + run: | |
| 52 | + sudo modprobe loop |
| 53 | + cd repository/src |
| 54 | + sudo BASE_BOARD=${{ matrix.board }} bash -x ./build_dist |
| 55 | +
|
| 56 | + - name: Copy output |
| 57 | + id: copy |
| 58 | + run: | |
| 59 | + source repository/src/config |
| 60 | + NOW=$(date +"%Y-%m-%d-%H%M") |
| 61 | + IMAGE="${NOW}-fullpageos-${DIST_VERSION}-${{ matrix.arch }}" |
| 62 | + cp repository/src/workspace/*.img ${IMAGE}.img |
| 63 | + echo "image=${IMAGE}" >> $GITHUB_OUTPUT |
| 64 | +
|
| 65 | + - uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: fullpageos-${{ matrix.arch }} |
| 68 | + path: ${{ steps.copy.outputs.image }}.img |
| 69 | + |
| 70 | + e2e-test: |
| 71 | + needs: build |
| 72 | + runs-on: ubuntu-latest |
| 73 | + timeout-minutes: 30 |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + |
| 77 | + - name: Checkout CustomPiOS |
| 78 | + uses: actions/checkout@v4 |
| 79 | + with: |
| 80 | + repository: 'guysoft/CustomPiOS' |
| 81 | + path: CustomPiOS |
| 82 | + |
| 83 | + - name: Download arm64 image from build |
| 84 | + uses: actions/download-artifact@v4 |
| 85 | + with: |
| 86 | + name: fullpageos-arm64 |
| 87 | + path: image/ |
| 88 | + |
| 89 | + - name: Prepare testing context |
| 90 | + run: | |
| 91 | + mkdir -p testing/custompios |
| 92 | + cp -r CustomPiOS/src/distro_testing/scripts testing/custompios/scripts |
| 93 | + cp -r CustomPiOS/src/distro_testing/tests testing/custompios/tests |
| 94 | +
|
| 95 | + - name: Build test Docker image |
| 96 | + run: DOCKER_BUILDKIT=0 docker build -t fullpageos-e2e-test ./testing/ |
| 97 | + |
| 98 | + - name: Start E2E test container |
| 99 | + run: | |
| 100 | + mkdir -p artifacts |
| 101 | + IMG=$(find image/ -name '*.img' | head -1) |
| 102 | + docker run -d --name fullpageos-test \ |
| 103 | + -v "$PWD/artifacts:/output" \ |
| 104 | + -v "$(realpath $IMG):/input/image.img:ro" \ |
| 105 | + -e ARTIFACTS_DIR=/output \ |
| 106 | + -e DISTRO_NAME="FullPageOS" \ |
| 107 | + -e QEMU_EXTRA_ARGS="-device virtio-gpu-pci" \ |
| 108 | + -e KEEP_ALIVE=true \ |
| 109 | + fullpageos-e2e-test |
| 110 | +
|
| 111 | + - name: Wait for tests to complete |
| 112 | + run: | |
| 113 | + for i in $(seq 1 180); do |
| 114 | + [ -f artifacts/exit-code ] && break |
| 115 | + sleep 5 |
| 116 | + done |
| 117 | + if [ ! -f artifacts/exit-code ]; then |
| 118 | + echo "ERROR: Tests did not complete within 15 minutes" |
| 119 | + docker logs fullpageos-test 2>&1 | tail -80 |
| 120 | + exit 1 |
| 121 | + fi |
| 122 | + echo "Tests finished with exit code: $(cat artifacts/exit-code)" |
| 123 | + cat artifacts/test-results.txt 2>/dev/null || true |
| 124 | +
|
| 125 | + - name: Collect logs and stop container |
| 126 | + if: always() |
| 127 | + run: | |
| 128 | + docker logs fullpageos-test > artifacts/container.log 2>&1 || true |
| 129 | + docker stop fullpageos-test 2>/dev/null || true |
| 130 | +
|
| 131 | + - name: Check test result |
| 132 | + run: exit "$(cat artifacts/exit-code 2>/dev/null || echo 1)" |
| 133 | + |
| 134 | + - uses: actions/upload-artifact@v4 |
| 135 | + if: always() |
| 136 | + with: |
| 137 | + name: e2e-test-results |
| 138 | + path: artifacts/ |
0 commit comments