Skip to content

Commit

Permalink
build-sd-images.yml: Fix test setup
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 6, 2024
1 parent 93f76ec commit bbed326
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
45 changes: 38 additions & 7 deletions .github/workflows/build-sd-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
# update-binfmts --display qemu-arm
- name: "Build Armbian"
id: build-armbian
if: "${{ inputs.board_id != 'rpi5b' }}"
continue-on-error: true
run: |
set -ex
Expand All @@ -79,7 +80,7 @@ jobs:
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: "Build Armbian (2nd attempt)"
if: ${{ steps.build-armbian.outcome == 'failure' }}
if: ${{ steps.build-armbian.outcome == 'failure' && inputs.board_id != 'rpi5b' }}
id: build-armbian-2nd
run: |
set -ex
Expand All @@ -96,13 +97,27 @@ jobs:
mv "${artifacts[0]}" "output/$IMG"
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
# - name: "Download test image"
# if: "${{ inputs.board_id == 'rpi5b' }}"
# run: |
# mkdir -p output
# wget -q -O output/Armbian_Test.img https://pack.minecraft.private-cloud.network/NCP_Armbian_Test.img
# echo "ARTIFACT_FILE=Armbian_Test.img" >> $GITHUB_ENV
# echo "artifact_file=Armbian_Test.img" >> $GITHUB_OUTPUT

- name: "Upload Armbian logs"
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ github.run_id }}-${{ inputs.board_id }}-logs
path: armbian/output
- name: Set variables
if: "${{ inputs.board_id == 'rpi5b' }}"
run: |
echo "ARTIFACT_FILE=Armbian_Test.img" >> $GITHUB_ENV
echo "artifact_file=Armbian_Test.img" >> $GITHUB_OUTPUT
- name: upload image to artifact store
if: "${{ inputs.board_id != 'rpi5b' }}"
uses: actions/upload-artifact@v3
with:
name: ${{ github.run_id }}-${{ inputs.board_id }}-image
Expand All @@ -129,15 +144,30 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Disable apparmor
run: |
sudo apt-get update
sudo apt-get install -y binfmt-support
curl -L -o /tmp/qemu.sh 'https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh'
bash /tmp/qemu.sh --debian
sudo systemctl disable apparmor
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
- name: Checkout code
uses: actions/checkout@v3
with:
ref: "${{ env.VERSION }}"
- uses: actions/download-artifact@v3
if: "${{ inputs.board_id != 'rpi5b' }}"
with:
name: ${{ env.ARTIFACT_ID }}
path: output
- name: "Download test image"
if: "${{ inputs.board_id == 'rpi5b' }}"
run: |
mkdir -p output
wget -q -O output/Armbian_Test.img https://pack.minecraft.private-cloud.network/NCP_Armbian_Test.img
echo "ARTIFACT_FILE=Armbian_Test.img" >> $GITHUB_ENV
echo "artifact_file=Armbian_Test.img" >> $GITHUB_OUTPUT
- name: Prepare test
run: |
set -x
Expand All @@ -154,6 +184,7 @@ jobs:
sudo chmod +x raspbian_root/usr/bin/qemu-{arm,aarch64}-static
echo 'Mutex posixsem' | sudo tee -a raspbian_root/etc/apache2/mods-available/ssl.conf
echo 'ignore-warnings ARM64-COW-BUG' | sudo tee -a raspbian_root/etc/redis/redis.conf
sudo sed -i 's/NoExecPaths=.*//g' raspbian_root/usr/lib/systemd/system/redis-server.service
sudo mkdir -p raspbian_root/etc/systemd/system/redis-server.service.d
echo '[Service]' | sudo tee raspbian_root/etc/systemd/system/redis-server.service.d/ncp.conf
echo 'PrivateUsers=false' | sudo tee -a raspbian_root/etc/systemd/system/redis-server.service.d/ncp.conf
Expand Down Expand Up @@ -282,20 +313,20 @@ jobs:
echo -e "${LOG_DIAG} /etc/os-release:"
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'cat /etc/os-release'
echo -e "${LOG_DIAG} /usr/local/etc/ncp.cfg:"
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'cat /usr/local/etc/ncp.cfg'
"${CONTAINER_CMD[@]}" --pipe -q ncp /bin/bash -c 'cat /usr/local/etc/ncp.cfg'
cat ./raspbian_root/usr/local/etc/ncp.cfg
echo -e "${LOG_DIAG} /home/ncp-app-bridge confi g ncp"
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'sudo -u www-data sudo /home/www/ncp-app-bridge.sh config ncp'
echo -e "${LOG_DIAG} /home/ncp-app-bridge config ncp"
sudo ls -l ./raspbian_root/home/www/ncp-app-bridge.sh
"${CONTAINER_CMD[@]}" --pipe --uid=33 ncp /bin/bash -c 'sudo /home/www/ncp-app-bridge.sh config ncp'
echo -e "{$LOG_DIAG} Geckodriver logs:"
tail -n 20 geckodriver.log >&2 |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
echo -e "${LOG_CICD} ================"
echo -e "${LOG_DIAG} ncp.log: "
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c "tail -n20 /var/log/ncp.log" |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
"${CONTAINER_CMD[@]}" --pipe ncp /bin/bash -c "tail -n20 /var/log/ncp.log" |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
echo "================"
echo "${LOG_DIAG} Nextcloud log: "
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'ls -l /opt/ncdata/data/nextcloud.log' |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
"${CONTAINER_CMD[@]}" -q ncp /bin/bash -c 'cat /opt/ncdata/data/nextcloud.log' |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
"${CONTAINER_CMD[@]}" --pipe -q ncp /bin/bash -c 'ls -l /opt/ncdata/data/nextcloud.log' |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
"${CONTAINER_CMD[@]}" --pipe -q ncp /bin/bash -c 'cat /opt/ncdata/data/nextcloud.log' |& awk "{ print \"${LOG_DIAG} \" \$0 }" || true
sudo cat ./raspbian_root/opt/ncdata/data/nextcloud.log |& awk "{ print \"${LOG_DIAG} \" \$0 }"
sleep 12
continue
Expand Down
3 changes: 3 additions & 0 deletions tests/nextcloud_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import re
import time
from pathlib import Path
from pprint import pprint

from selenium import webdriver
from selenium.webdriver.common.by import By
Expand Down Expand Up @@ -286,6 +287,8 @@ def test_nextcloud(IP: str, nc_port: str, driver: WebDriver, skip_release_check:
print(f"{tc.yellow}{divs[1].text} != {ncp_cfg['release']}")
failed = list(map(lambda item: item[0], filter(lambda item: not item[1], expected.items())))
test.check(len(failed) == 0, f"checks failed for admin section: [{', '.join(failed)}]")
if failed:
pprint(expected)
except Exception as e:
test.check(e)
test.new("admin section (2)")
Expand Down

0 comments on commit bbed326

Please sign in to comment.