Skip to content

Commit

Permalink
build-sd-images.yml: Fix armbian tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Knöppler <[email protected]>
  • Loading branch information
theCalcaholic committed Sep 5, 2024
1 parent 31d5ed9 commit 8538bfe
Showing 1 changed file with 16 additions and 47 deletions.
63 changes: 16 additions & 47 deletions .github/workflows/build-sd-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,28 @@ jobs:
# update-binfmts --display qemu-aarch64
# update-binfmts --display qemu-arm
- name: "Build Armbian"
if: ${{ inputs.board_id != 'raspberrypi' }}
id: build-armbian
continue-on-error: true
run: |
set -ex
export IMG="NextcloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img"
[[ "${{ github.ref_protected }}" == true ]] || export DBG=x
./build/build-SD-armbian.sh "${{ inputs.board_id }}" "${{ inputs.board_name }}"
artifacts=("armbian/output/images/Armbian"*.img)
mkdir -p output
mv "${artifacts[0]}" "output/$IMG"
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: "Build Armbian (2nd attempt)"
if: ${{ inputs.board_id != 'raspberrypi' && steps.build-armbian.outcome == 'failure' }}
if: ${{ steps.build-armbian.outcome == 'failure' }}
id: build-armbian-2nd
run: |
set -ex
echo -e "${LOG_CICD} Cleanup armbian build leftovers..."
sudo rm -rf armbian/ tmp/ output/
export IMG="NextcloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img"
[[ "${{ github.ref_protected }}" == true ]] || export DBG=x
Expand All @@ -98,34 +97,11 @@ jobs:
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: "Upload Armbian logs"
if: ${{ inputs.board_id != 'raspberrypi' && failure() }}
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ github.run_id }}-${{ inputs.board_id }}-logs
path: armbian/output
- name: Build RPI SD Image
if: ${{ inputs.board_id == 'raspberrypi' }}
id: build-rpi
run: |
set -ex
echo -e "${LOG_CICD} Protected? ${{ github.ref_protected }}"
export IMG="NextcloudPi_${{ inputs.board_name }}_${VERSION//\//_}.img"
[[ "${{ github.ref_protected }}" == true ]] || export DBG=x
wget -q https://github.com/multiarch/qemu-user-static/releases/latest/download/qemu-aarch64-static -O ./qemu-aarch64-static
./build/build-SD-rpi.sh
mkdir -p output
mv "tmp/$IMG" ./output/
for i in {1..10}
do
sudo losetup | grep "${IMG}" || break;
[[ "$i" -lt 10 ]] || { echo -e "${LOG_CICD} Timeout while waiting for image to unmount"; exit 1; }
sleep 6
echo -e "${LOG_CICD} Retrying ($i out of 10)"
done
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: upload image to artifact store
uses: actions/upload-artifact@v3
with:
Expand All @@ -135,7 +111,7 @@ jobs:

test:
needs: build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
VERSION: "${{ inputs.git_ref }}"
ARTIFACT_ID: ${{ needs.build.outputs.artifact_name }}
Expand All @@ -151,18 +127,9 @@ jobs:
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up QEMU
- name: Disable apparmor
run: |
sudo apt-get update
sudo apt-get install -y binfmt-support
docker run --rm --privileged tonistiigi/binfmt:latest --install all
docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes
# sudo systemctl disable apparmor
# sudo mkdir -p /etc/binfmt
# for conf in qemu-{aarch64,arm}-static.conf
# do
# sed 's/:F$/:OC/' /usr/lib/binfmt.d/$conf | sudo tee /etc/binfmt/$conf
# done
sudo systemctl disable apparmor
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -249,12 +216,14 @@ jobs:
done
[[ "$success" == "true" ]] || {
echo -e "${LOG_CICD} Timeout reached."
"${CONTAINER_CMD[@]}" -q systemctl status mysql |& awk "{ print \"${LOG_DIAG} \" \$0 }"
"${CONTAINER_CMD[@]}" -q systemctl status redis |& awk "{ print \"${LOG_DIAG} \" \$0 }"
"${CONTAINER_CMD[@]}" -q systemctl status 'php*-fpm' |& awk "{ print \"${LOG_DIAG} \" \$0 }"
"${CONTAINER_CMD[@]}" -q systemctl status apache2 |& awk "{ print \"${LOG_DIAG} \" \$0 }"
"${CONTAINER_CMD[@]}" -q ncp-diag |& awk "{ print \"${LOG_DIAG} \" \$0 }"
echo -e "${LOG_CICD} ERR: Timeout reached."
"${CONTAINER_CMD[@]}" -q systemctl status mysql |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||:
"${CONTAINER_CMD[@]}" -q systemctl status redis-server |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||:
sudo journalctl --file ./raspbian_root/var/log/journal/"$(sudo cat ./raspbian_root/etc/machine-id)"/system.journal --no-pager -eu redis-server ||:
"${CONTAINER_CMD[@]}" -q journalctl --no-pager -eu redis-server
"${CONTAINER_CMD[@]}" -q systemctl status 'php*-fpm' |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||:
"${CONTAINER_CMD[@]}" -q systemctl status apache2 |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||:
"${CONTAINER_CMD[@]}" -q ncp-diag |& awk "{ print \"${LOG_DIAG} \" \$0 }" ||:
exit 1
}
Expand Down

0 comments on commit 8538bfe

Please sign in to comment.