Download the Debian nocloud image, boot with barebox into Linux and do some rudimentary tests on the shell and then cache it for next time.
To make it easier for manual use, the downloading is done by a separate script. The download info message is intentionally a warning, so we have a chance of noticing if the Github Actions caching doesn't work as we expect, so we can take measures instead of needlessly hitting Debian infra too often. I tried using runs-on: ubuntu-latest-arm, but there are less ARM workers and the job takes longer to schedule it seems, so sticking with the normal x86 runners. Signed-off-by: Ahmad Fatoum <[email protected]> --- .github/workflows/test-labgrid-pytest.yml | 20 +++++++++++++ .gitignore | 4 +++ scripts/fetch-os.sh | 35 +++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100755 scripts/fetch-os.sh diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml index d9822fc206a5..de06fab3e136 100644 --- a/.github/workflows/test-labgrid-pytest.yml +++ b/.github/workflows/test-labgrid-pytest.yml @@ -28,6 +28,11 @@ jobs: defconfig: multi_v8_defconfig lgargs: --runxfail + - ARCH: arm + lgenv: test/arm/multi_v8_efiloader_defconfig.yaml + defconfig: multi_v8_efiloader_defconfig + osimg: debian-13-nocloud-arm64.qcow2 + - ARCH: mips lgenv: test/mips/qemu-malta_defconfig.yaml defconfig: qemu-malta_defconfig @@ -64,6 +69,21 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Cache OS image + id: cache-osimg + if: ${{ matrix.osimg != '' }} + uses: actions/cache@v4 + with: + path: ${{ matrix.osimg }} + key: osimg-${{ matrix.osimg }} + restore-keys: osimg-${{ matrix.osimg }}- + + - name: Download OS image + if: ${{ steps.cache-osimg.outputs.cache-hit != 'true' && matrix.osimg != '' }} + run: | + echo "::warning::Cache miss - downloading fresh OS image from Debian infra." + scripts/fetch-os.sh + - name: Determine used features id: used-features run: | diff --git a/.gitignore b/.gitignore index 74cb7b092834..1b335c330091 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,7 @@ default.profdata default.profraw coverage.info coverage_html/ + +# Disk images (used for testing) +/*.raw +/*.qcow2 diff --git a/scripts/fetch-os.sh b/scripts/fetch-os.sh new file mode 100755 index 000000000000..649e4efe9a05 --- /dev/null +++ b/scripts/fetch-os.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +wgetopts="" +if [ -n "$GITHUB_ACTIONS" ]; then + wgetopts="-nv" +fi + +set -euo pipefail + +declare -A images=( + ["debian-13-nocloud-arm64.qcow2"]="https://cloud.debian.org/images/cloud/trixie/latest/debian-13-nocloud-arm64.qcow2" +) + +found=0 +dl=0 + +for image in "${!images[@]}"; do + if [ -e "$image" ]; then + ((++found)) + else + wget -c $wgetopts -O "$image" "${images[$image]}" + ((++dl)) + fi +done + +if [ "$found" -eq 0 ]; then + echo -n "No images found. "; +else + echo -n "Found $found images(s). "; +fi +if [ "$dl" -eq 0 ]; then + echo "Nothing needed to be downloaded."; +else + echo "$dl missing images downloaded."; +fi -- 2.47.3
