Skip to content

Commit

Permalink
Merge commits from release v1.50.5
Browse files Browse the repository at this point in the history
  • Loading branch information
theCalcaholic authored Jan 8, 2023
2 parents a17d684 + d9cb654 commit 50a6fef
Show file tree
Hide file tree
Showing 36 changed files with 1,038 additions and 462 deletions.
238 changes: 167 additions & 71 deletions .github/workflows/build-docker.yml

Large diffs are not rendered by default.

177 changes: 151 additions & 26 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,99 @@ 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: ChlodAlejandro/setup-geckodriver@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
- 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,21 +331,33 @@ 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
uses: browser-actions/setup-geckodriver@latest
uses: ChlodAlejandro/setup-geckodriver@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Selenium
run: pip install selenium
- 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
24 changes: 12 additions & 12 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 Expand Up @@ -201,9 +201,9 @@ jobs:
}
success=false
for attempt in {1..3}
for attempt in {1..5}
do
echo ":: Activation Tests (attempt $attempt/3) ::"
echo ":: Activation Tests (attempt $attempt/5) ::"
python tests/activation_tests.py -t 300 --no-gui "$ip" 443 4443 || {
echo "Activation test failed!"
echo "Geckodriver logs:"
Expand All @@ -212,7 +212,7 @@ jobs:
echo "mysql: "
sudo systemd-run --wait -P --machine=ncp bash /usr/local/bin/ncp-diag
sudo systemd-run --wait -P --machine=ncp systemctl status mysql
sleep 6
sleep 12
continue
}
success=true
Expand All @@ -224,12 +224,12 @@ jobs:
}
success=false
for attempt in {1..3}
for attempt in {1..5}
do
echo ":: System Tests (attempt $attempt/3) ::"
echo ":: System Tests (attempt $attempt/5) ::"
sudo python tests/system_tests.py --non-interactive || {
echo "System test failed!"
sleep 6
sleep 12
continue
}
success=true
Expand All @@ -241,17 +241,17 @@ jobs:
}
success=false
for attempt in {1..3}
for attempt in {1..5}
do
echo ":: Nextcloud Tests (attempt $attempt/3) ::"
echo ":: Nextcloud Tests (attempt $attempt/5) ::"
python tests/nextcloud_tests.py --no-gui "$ip" 443 4443 || {
echo "Nextcloud test failed!"
echo "Geckodriver logs:"
tail -n 20 geckodriver.log >&2 || true
echo "================"
echo "ncp.log: "
sudo systemd-run --wait -P --machine=ncp ncp /bin/bash -c "tail -n20 /var/log/ncp.log" || true
sleep 6
sleep 12
continue
}
success=true
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ jobs:
docker tag "thecalcaholic/ncp-internal-${arch}:${{ github.run_id }}" "ownyourbits/nextcloudpi-${arch}:${version?}"
docker tag "ownyourbits/nextcloudpi-${arch}:${version?}" "ownyourbits/nextcloudpi-${arch}:latest"
docker push "ownyourbits/nextcloudpi-${arch}:${version?}"
docker push "ownyourbits/nextcloudpi-${arch}:latest"
[[ "$version" =~ ^v[0-9]+'.'[0-9]+'.'[0-9]+$ ]] && docker push "ownyourbits/nextcloudpi-${arch}:latest"
done
docker manifest create ownyourbits/nextcloudpi:${version?} \
Expand All @@ -294,6 +294,10 @@ jobs:
- name: Create manifest and push as latest to docker hub
run: |
[[ "$version" =~ ^v[0-9]+'.'[0-9]+'.'[0-9]+$ ]] || {
echo "not tagging latest - is a pre-/beta-release"
exit 0
}
docker manifest create ownyourbits/nextcloudpi:latest \
ownyourbits/nextcloudpi-armhf:latest \
ownyourbits/nextcloudpi-x86:latest \
Expand Down
Loading

0 comments on commit 50a6fef

Please sign in to comment.