Skip to content

Commit

Permalink
Switch unit test to dedicated Armbian VM images
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Jan 14, 2025
1 parent 4e1ed48 commit ce9c094
Showing 1 changed file with 13 additions and 93 deletions.
106 changes: 13 additions & 93 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand All @@ -45,7 +45,7 @@ jobs:
echo 'JSON_CONTENT<<EOF' >> $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
Expand All @@ -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-*

0 comments on commit ce9c094

Please sign in to comment.