Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/devel' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
theCalcaholic committed Jan 5, 2023
2 parents df42f29 + 89ed7e5 commit 0311cd0
Show file tree
Hide file tree
Showing 28 changed files with 961 additions and 430 deletions.
222 changes: 157 additions & 65 deletions .github/workflows/build-docker.yml

Large diffs are not rendered by default.

171 changes: 146 additions & 25 deletions .github/workflows/build-lxd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
type: string
outputs:
artifact_name:
value: "${{ jobs.build.outputs.artifact_name }}"
value: "${{ jobs.build-current.outputs.artifact_name }}"
artifact_file:
value: "${{ jobs.build.outputs.artifact_file }}"
value: "${{ jobs.build-current.outputs.artifact_file }}"
push:
branches:
- "**"
Expand All @@ -19,8 +19,8 @@ on:
- "devel"

jobs:
build:
runs-on: ubuntu-latest
build-current:
runs-on: ubuntu-20.04
outputs:
artifact_name: "${{ env.ARTIFACT_NAME }}"
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
Expand All @@ -35,6 +35,28 @@ jobs:
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable

# - name: Fix LXD
# run: |
# ip address
# ip route list
# lxc profile create network
# cat <<EOF | lxc profile edit network
# devices:
# eth0:
# name: eth0
# parent: lxdbr0
# nictype: bridged
# type: nic
# EOF
# ip route list
# ifconfig lxdbr0

- name: Debug LXD
run: |
lxc version
lxc network set lxdbr0 ipv4.nat true
lxc network list
- name: Build LXD image
run: |
./build/build-LXD.sh
Expand All @@ -44,7 +66,7 @@ jobs:
. ./build/buildlib.sh
ARTIFACT_FILE="NextCloudPi_LXD_${VERSION//\//_}"
lxc image export -q ncp/"${version}" "output/${ARTIFACT_FILE}"
echo "::set-output name=artifact_file::${ARTIFACT_FILE}.tar.gz"
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
- name: upload LXD image to artifact store
uses: actions/upload-artifact@v3
with:
Expand All @@ -53,14 +75,15 @@ jobs:
if-no-files-found: error

build-previous:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
artifact_name: "${{ env.ARTIFACT_NAME }}"
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
previous_version: "${{ steps.checkout_previous_version.outputs.previous_version }}"
env:
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
ARTIFACT_NAME: "${{ github.run_id }}-lxd-image-previous"
LXD_EXTRA_PROFILE: network
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -93,10 +116,21 @@ jobs:
echo "Previous version is '$version'"
git checkout "$version"
echo "VERSION=$version" >> "$GITHUB_ENV"
echo "::set-output name=previous_version::${version}"
echo "previous_version=${version}" >> $GITHUB_OUTPUT
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
devices:
eth0:
name: eth0
parent: lxdbr0
nictype: bridged
type: nic
EOF
- name: Build LXD image
run: |
./build/build-LXD.sh
Expand All @@ -106,7 +140,7 @@ jobs:
. ./build/buildlib.sh
ARTIFACT_FILE="NextCloudPi_LXD_${VERSION//\//_}"
lxc image export -q ncp/"${version}" "output/${ARTIFACT_FILE}"
echo "::set-output name=artifact_file::${ARTIFACT_FILE}.tar.gz"
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
- name: upload LXD image to artifact store
uses: actions/upload-artifact@v3
with:
Expand All @@ -117,7 +151,7 @@ jobs:
update-previous:
needs:
- build-previous
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
outputs:
artifact_name: "${{ env.ARTIFACT_NAME }}"
artifact_file: "${{ steps.pack-lxd.outputs.artifact_file }}"
Expand All @@ -128,6 +162,17 @@ jobs:
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
devices:
eth0:
name: eth0
parent: lxdbr0
nictype: bridged
type: nic
EOF
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -185,31 +230,97 @@ jobs:
lxc publish -q ncp -f --alias "ncp/updated"
mkdir -p output
lxc image export -q "ncp/updated" "output/${ARTIFACT_FILE}"
echo "::set-output name=artifact_file::${ARTIFACT_FILE}.tar.gz"
echo "artifact_file=${ARTIFACT_FILE}.tar.gz" >> $GITHUB_OUTPUT
- name: upload LXD image to artifact store
uses: actions/upload-artifact@v3
with:
name: "${{ env.ARTIFACT_NAME }}"
path: "output/${{ steps.pack-lxd.outputs.artifact_file }}"
if-no-files-found: error

test:
test-fresh-install:
needs:
- build-current
runs-on: ubuntu-20.04
env:
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
ARTIFACT_NAME: ${{ needs.build-current.outputs.artifact_name }}
ARTIFACT_FILE: ${{ needs.build-current.outputs.artifact_file }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: "${{ env.VERSION }}"
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
EOF
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
- name: Setup GeckoDriver
uses: browser-actions/setup-geckodriver@latest
- name: Setup Selenium
run: pip install selenium
- name: download LXD image from artifact store
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
- name: Launch ncp container
run: |
set -x
lxc delete -q -f ncp || true
lxc image import -q "./${ARTIFACT_FILE?}" --alias "ncp/test"
systemd-run --user --scope -p "Delegate=yes" lxc launch -q "ncp/test" ncp
lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
sleep 30
ip="$(lxc list -c n4 -f csv | grep '^ncp' | cut -d ',' -f2)"
ip="${ip/% *}"
echo "${ip} nextcloudpi.local" | sudo tee /etc/hosts
- name: Test LXD Image
working-directory: ./tests
run: |
lxc exec ncp -- bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
python activation_tests.py --no-gui "nextcloudpi.local" 443 4443 || {
echo "Activation test failed!"
echo "Geckodriver logs:"
tail -n 20 geckodriver.log >&2 || true
echo "================"
echo "ncp.log: "
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
exit 1
}
python system_tests.py --non-interactive || {
echo "System test failed!"
exit 1
}
python nextcloud_tests.py --no-gui "nextcloudpi.local" 443 4443 || {
echo "Nextcloud test failed!"
echo "Geckodriver logs:"
tail -n 20 geckodriver.log >&2 || true
echo "================"
echo "ncp.log: "
lxc exec ncp -- "tail -n20 /var/log/ncp.log"
exit 1
}
lxc stop ncp
test-update:
needs:
- build
- update-previous
strategy:
matrix:
build:
- source: install
artifact_name: ${{ needs.build.outputs.artifact_name }}
artifact_file: ${{ needs.build.outputs.artifact_file }}
- source: update
artifact_name: ${{ needs.update-previous.outputs.artifact_name }}
artifact_file: ${{ needs.update-previous.outputs.artifact_file }}
fail-fast: false
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
VERSION: "${{ inputs.git_ref || github.head_ref || github.ref_name }}"
ARTIFACT_NAME: ${{ needs.update-previous.outputs.artifact_name }}
ARTIFACT_FILE: ${{ needs.update-previous.outputs.artifact_file }}
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -218,6 +329,16 @@ jobs:
- uses: whywaita/setup-lxd@v1
with:
lxd_version: latest/stable
- name: Fix LXD
run: |
lxc profile create network
cat <<EOF | lxc profile edit network
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
EOF
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
- name: Setup GeckoDriver
Expand All @@ -227,12 +348,12 @@ jobs:
- name: download LXD image from artifact store
uses: actions/download-artifact@v3
with:
name: ${{ matrix.build.artifact_name }}
name: ${{ env.ARTIFACT_NAME }}
- name: Launch ncp container
run: |
set -x
lxc delete -q -f ncp || true
lxc image import -q "./${{ matrix.build.artifact_file }}" --alias "ncp/test"
lxc image import -q "./${ARTIFACT_FILE?}" --alias "ncp/test"
systemd-run --user --scope -p "Delegate=yes" lxc launch -q "ncp/test" ncp
lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
sleep 30
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-sd-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
artifacts=("armbian/output/images/Armbian"*.img)
mkdir -p output
mv "${artifacts[0]}" "output/$IMG"
echo "::set-output name=artifact_file::${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' }}
Expand All @@ -87,7 +87,7 @@ jobs:
artifacts=("armbian/output/images/Armbian"*.img)
mkdir -p output
mv "${artifacts[0]}" "output/$IMG"
echo "::set-output name=artifact_file::${IMG}"
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: "Upload Armbian logs"
if: ${{ inputs.board_id != 'raspberrypi' && failure() }}
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
echo "Retrying ($i out of 10)"
done
echo "::set-output name=artifact_file::${IMG}"
echo "artifact_file=${IMG}" >> $GITHUB_OUTPUT
echo "ARTIFACT_FILE=${IMG}" >> $GITHUB_ENV
- name: upload image to artifact store
uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/vm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
version="${version%-*-*}"
fi
echo "Previous version is '$version'"
echo "::set-output name=previous_version::${version}"
echo "previous_version=${version}" >> $GITHUB_OUTPUT
- run: |
set -x
mkdir -p ./.ssh
Expand Down Expand Up @@ -387,7 +387,7 @@ jobs:
steps:
- name: Delete old snapshots
run: |
for snapshot in $(hcloud image list -t snapshot -o noheader -o columns=id | head -n -20)
for snapshot in $(hcloud image list -t snapshot -o noheader -o columns=id | head -n -16)
do
echo "Deleting snapshot '$snapshot'..."
hcloud image delete "$snapshot"
Expand Down
Loading

0 comments on commit 0311cd0

Please sign in to comment.