diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index c8b4581..ae610d9 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -16,7 +16,7 @@ on: - '.github/workflows/test-action.yml' jobs: - test: + raspios-test: runs-on: ubuntu-latest if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name steps: @@ -53,3 +53,40 @@ jobs: with: name: logs.tar path: logs.tar + alpine-test: + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup environment + id: setup + run: | + sudo -E bash -c set + sudo add-apt-repository ppa:canonical-server/server-backports + sudo apt-get update + sudo apt-get install --yes gnupg xz-utils expect systemd-container qemu-user-static qemu-utils qemu-system-arm libfdt-dev + echo "imagegz=alpine-rpi-3.20.1-armhf.img.gz" >> $GITHUB_OUTPUT + echo "image=alpine-rpi-3.20.1-armhf.img" >> $GITHUB_OUTPUT + - name: Cache Raspberry Pi OS 32bit image + uses: actions/cache@v4 + with: + path: ${{ steps.setup.outputs.image }} + key: ${{ steps.setup.outputs.image }} + - name: Build image + run: sudo -E ./tests/image.bash "setup" "${{ steps.setup.outputs.imagegz }}" "${{ steps.setup.outputs.image }}" + shell: bash + - name: Run tests + run: | + cp "${{ steps.setup.outputs.image }}" raspios.img + sudo expect ./tests/run.exp + shell: bash + - name: Copy logs + if: always() + run: sudo ./tests/image.bash "copy-logs" "raspios.img" + - name: Upload logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: logs.tar + path: logs.tar diff --git a/tests/image.bash b/tests/image.bash index 8b565d8..0c87faf 100755 --- a/tests/image.bash +++ b/tests/image.bash @@ -19,17 +19,25 @@ imageFile() { if [[ $1 == "setup" ]]; then if ! [[ -f $3 ]]; then - curl -s -L "https://downloads.raspberrypi.org/raspios_lite_armhf_latest" -o "$2" - curl -s "$(curl "https://downloads.raspberrypi.org/raspios_lite_armhf_latest" -s -L -I -o /dev/null -w '%{url_effective}')".sig -o "${2}.sig" - gpg -q --keyserver keyserver.ubuntu.com --recv-key 0x8738CD6B956F460C - gpg -q --trust-model always --verify "${2}.sig" "$2" - xz "$2" -d + if [[ "$3" == "alpine-rpi-3.20.1-armhf.img" ]]; then + curl -s -L "https://dl-cdn.alpinelinux.org/alpine/v3.20/releases/armhf/alpine-rpi-3.20.1-armhf.img.gz" -o "$2" + curl -s https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/armhf/alpine-rpi-3.20.1-armhf.img.gz.asc -o "${2}.asc" + gpg -q --keyserver keyserver.ubuntu.com --recv-key 0x0482D84022F52DF1C4E7CD43293ACD0907D9495A + gpg -q --trust-model always --verify "${2}.asc" "$2" + gzip "$2" -d + else + curl -s -L "https://downloads.raspberrypi.org/raspios_lite_armhf_latest" -o "$2" + curl -s "$(curl "https://downloads.raspberrypi.org/raspios_lite_armhf_latest" -s -L -I -o /dev/null -w '%{url_effective}')".sig -o "${2}.sig" + gpg -q --keyserver keyserver.ubuntu.com --recv-key 0x8738CD6B956F460C + gpg -q --trust-model always --verify "${2}.sig" "$2" + xz "$2" -d + fi fi qemu-img resize -f raw "$3" 4G echo ", +" | sfdisk -N 2 "$3" imageFile "mount" "$3" - rsync -avr --exclude="*.img" --exclude="*.sig" --exclude="tests/fs" --exclude="tests/dtb" --exclude="tests/kernel" ./ tests/fs/opt/zram - systemd-nspawn --directory="tests/fs" /opt/zram/tests/install-packages.bash + rsync -avr --exclude="*.img" --exclude="*.sig" --exclude="*.asc" --exclude="tests/fs" --exclude="tests/dtb" --exclude="tests/kernel" ./ tests/fs/opt/zram + [[ "$3" == "alpine-rpi-3.20.1-armhf.img" ]] || systemd-nspawn --directory="tests/fs" /opt/zram/tests/install-packages.bash echo "set enable-bracketed-paste off" >> tests/fs/etc/inputrc # Prevents weird character output cp tests/fs/boot/kernel* tests/kernel # Compile a customized DTB