From ce9c094f52fac91f4c6aec3bc2288970e77927c6 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Mon, 13 Jan 2025 17:09:43 +0100 Subject: [PATCH] Switch unit test to dedicated Armbian VM images --- .github/workflows/unit-tests.yml | 106 ++++--------------------------- 1 file changed, 13 insertions(+), 93 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index db5419ce4..95c7a37e5 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -19,8 +19,8 @@ concurrency: jobs: - test: - name: "Unit tests" + prepare: + name: "Unit tests ${{ matrix.runs_on }}" runs-on: ubuntu-24.04 outputs: matrix: ${{steps.json.outputs.JSON_CONTENT}} @@ -45,7 +45,7 @@ jobs: echo 'JSON_CONTENT<> $GITHUB_OUTPUT # define docker images where we will run test install - dockerimages=("debian:bookworm" "ubuntu:jammy" "ubuntu:noble") + dockerimages=("bookworm" "jammy" "noble") # go to repo folder cd config @@ -68,113 +68,33 @@ jobs: elements=($(echo $RELEASE | tr ':' "\n")) for SELECTED_RELEASE in "${elements[@]}"; do if [[ $j == *"${SELECTED_RELEASE}"* ]]; then - echo "{\"package\":\"${i}\",\"image\":\"$j\"}" + echo "{\"package\":\"${i}\",\"os\":\"$j\"}" fi done done else for j in ${dockerimages[@]}; do - echo "{\"package\":\"${i}\",\"image\":\"$j\"}" + echo "{\"package\":\"${i}\",\"os\":\"$j\"}" done fi - done | jq -s >> $GITHUB_OUTPUT + done | jq -s + #>> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT gradle: - needs: test - if: ${{ needs.test.outputs.matrix != '[]' && needs.test.outputs.matrix != '' }} + needs: prepare + #if: ${{ needs.test.outputs.matrix != '[]' && needs.test.outputs.matrix != '' }} strategy: - fail-fast: false - max-parallel: 32 matrix: - image: ${{ fromJSON(needs.test.outputs.matrix) }} - - name: "I" - runs-on: ubuntu-24.04 + os: ${{ fromJSON(needs.prepare.outputs.os) }} + version: [10, 12, 14] + name: " ${{ matrix.os }} " + runs-on: ${{ matrix.os }} timeout-minutes: 7 - container: - image: "${{ matrix.image.image }}" steps: - name: Checkout uses: actions/checkout@v4 with: path: 'config' - - - name: Install - run: | - - mkdir -p test - - RELEASE=$(echo "${{ matrix.image.image }}" | cut -d":" -f2) - TEST_ID=$(echo "${{ matrix.image.package }}" | cut -d "/" -f2 | cut -d "." -f1) - - # store to GH environment - echo "TEST_ID=${TEST_ID}" >> $GITHUB_ENV - echo "RELEASE=${RELEASE}" >> $GITHUB_ENV - - # update index - apt update - # install basics - DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata keyboard-configuration wget gpg netcat-traditional lsof - - # add armbian repository - URL=apt.armbian.com - wget https://${URL}/armbian.key -O key - gpg --dearmor < key | tee /usr/share/keyrings/armbian.gpg > /dev/null - chmod go+r /usr/share/keyrings/armbian.gpg - echo "deb [signed-by=/usr/share/keyrings/armbian.gpg] http://${{ env.REPOSITORY }} $RELEASE main ${RELEASE}-utils ${RELEASE}-desktop" | tee /etc/apt/sources.list.d/armbian.list - apt update -y - apt upgrade -y - apt -y -o Dpkg::Options::="--force-confold" install sudo procps systemd whiptail jq lsb-release iproute2 armbian-bsp-cli-wsl2-x86-current-grub - sudo -b unshare --pid --fork --mount-proc /lib/systemd/systemd --system-unit=basic.target - - # install packages / except howdy as its too large - export DEBIAN_FRONTEND=noninteractive - cd config - bash tools/config-assemble.sh -p - #eval $"( "${PREINSTALL}" )" - eval "$PREINSTALL" - sudo bash bin/armbian-config --cmd "$TEST_ID" - #eval $"( "${CONDITION}" )" - eval "$CONDITION" - - RAWCOMMAND=$(bash bin/armbian-config --cmd | grep "${TEST_ID}" | xargs) - COMMAND=$(echo $RAWCOMMAND | cut -d" " -f1,2) - DESCRIPTION=$(echo $RAWCOMMAND | cut -d" " -f4-) - echo "|${RELEASE}|\`armbian-config ${COMMAND}\`| ${DESCRIPTION} |" > ../test/${TEST_ID}-${RELEASE} - - - name: "Upload ${{ env.TEST_ID }} for ${{ env.RELEASE }}" - uses: actions/upload-artifact@v4 - with: - name: test-${{ env.TEST_ID }}-${{ env.RELEASE }} - path: test - if-no-files-found: ignore - - stop: - name: "Merge test artifacts" - if: always() - needs: gradle - runs-on: ubuntu-24.04 - steps: - - - name: Download All Artifacts - uses: actions/download-artifact@v4 - with: - path: test - pattern: test-* - merge-multiple: true - - - name: Install - run: | - - echo "# Succesful tests:" >> $GITHUB_STEP_SUMMARY - echo "|Release|Command|Description|" >> $GITHUB_STEP_SUMMARY - echo "|:---|:---|:---|" >> $GITHUB_STEP_SUMMARY - cat test/* | sed '$ s/.$//' >> $GITHUB_STEP_SUMMARY - - - uses: geekyeggo/delete-artifact@v5 - with: - name: | - test-*