Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

feat(tests): add automated release upgrade test. Closes #1876

Gabe Kangas5d7d3213402e
diff --git a/.github/workflows/releases-upgrades-tests.yml b/.github/workflows/releases-upgrades-tests.yml
new file mode 100644
index 0000000000..6b6329108e
--- /dev/null
+++ b/.github/workflows/releases-upgrades-tests.yml
@@ -0,0 +1,38 @@
+name: Release and upgrade tests
+
+on:
+ schedule:
+ - cron: '0 */4 * * * '
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - id: skip_check
+ uses: fkirc/skip-duplicate-actions@v5
+ with:
+ concurrent_skipping: 'same_content_newer'
+
+ - uses: earthly/actions-setup@v1
+ with:
+ version: 'latest'
+
+ - name: Earthly version
+ run: earthly --version
+
+ - name: Set up QEMU
+ id: qemu
+ uses: docker/setup-qemu-action@v2
+ with:
+ image: tonistiigi/binfmt:latest
+ platforms: all
+
+ - uses: actions/checkout@v3
+
+ - name: Run release upgrade tests
+ uses: nick-fields/retry@v2
+ with:
+ timeout_minutes: 10
+ max_attempts: 3
+ command: cd test/automated/upgrades && ./run.sh
diff --git a/test/automated/upgrades/README.md b/test/automated/upgrades/README.md
new file mode 100644
index 0000000000..103a718d53
--- /dev/null
+++ b/test/automated/upgrades/README.md
@@ -0,0 +1,9 @@
+# Automated Owncast releases and upgrade test
+
+## Upgrades in succession tests
+
+This test will automatically download each release, one after another, to verify they all run in order. It concludes by creating a build from the `develop` branch and running the upgrade to that in order to verify the upcoming release.
+
+## First to last test
+
+This test will automatically download the first release and then upgrade to the development branch to verify that a user can successfully skip versions when upgrading.
diff --git a/test/automated/upgrades/run.sh b/test/automated/upgrades/run.sh
new file mode 100755
index 0000000000..0138b93fec
--- /dev/null
+++ b/test/automated/upgrades/run.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+
+# This script will download all the releases of Owncast and test them
+# to ensure that upgrades work as expected. It will also test the
+# development branch as the final test.
+# It is hard coded to run under 64bit intel linux.
+
+# set -o errexit
+set -o pipefail
+
+releases=(
+ "https://github.com/owncast/owncast/releases/download/v0.0.6/owncast-0.0.6-linux-64bit.zip"
+ "https://github.com/owncast/owncast/releases/download/v0.0.7/owncast-0.0.7-linux-64bit.zip"
+ "https://github.com/owncast/owncast/releases/download/v0.0.8/owncast-0.0.8-linux-64bit.zip"
+ "https://github.com/owncast/owncast/releases/download/v0.0.9/owncast-0.0.9-linux-64bit.zip"
+ "https://github.com/owncast/owncast/releases/download/v0.0.10/owncast-0.0.10-linux-64bit.zip"
+ "https://github.com/owncast/owncast/releases/download/v0.0.11/owncast-0.0.11-linux-64bit.zip"
+ "https://github.com/owncast/owncast/releases/download/v0.0.12/owncast-0.0.12-linux-64bit.zip"
+ "https://github.com/owncast/owncast/releases/download/v0.0.13/owncast-0.0.13-linux-64bit.zip"
+)
+
+echo "--------------------------------------------"
+echo "Owncast releases upgrade test."
+echo "Will download ${#releases[@]} releases plus the development branch."
+echo "Please wait, as this will take a while."
+printf "\n"
+
+rm -rf releases
+rm -rf owncast
+rm -rf src
+
+mkdir -p releases
+mkdir -p src
+
+download_release() {
+ url=$1
+
+ echo "--------------------------------------------"
+ echo "Downloading $url"
+
+ zipfile="releases/$(basename "$url")"
+ curl -sL "${url}" --output "${zipfile}"
+}
+
+test_release() {
+ pushd ./owncast >>/dev/null || exit
+ timeout --preserve-status 10 ./owncast
+ popd >>/dev/null || exit
+}
+
+build_development() {
+ echo "Building test release from current development branch..."
+ cd src || exit
+ git clone https://github.com/owncast/owncast
+ cd owncast || exit
+ earthly +package --platform="linux/amd64"
+ mv dist/owncast-develop-linux-64bit.zip ../../releases/owncast-develop-linux-64bit.zip
+ cd ../..
+}
+
+unzip_release() {
+ zipfile="releases/$(basename "$1")"
+ unzip -o "${zipfile}" -d "owncast" >>/dev/null
+}
+
+# Test all the releases in a row
+for release in "${releases[@]}"; do
+ if [ ! -f "releases/$(basename "$1")" ]; then
+ download_release "$release"
+ fi
+
+ unzip_release "$(basename "$release")"
+ test_release
+done
+
+# # Build and run the latest release
+build_development
+unzip_release owncast-develop-linux-64bit.zip
+test_release
+
+# Test jumping from the first release to the development release
+rm -rf owncast
+
+if [ ! -f "releases/$(basename "${releases[0]}")" ]; then
+ download_release "${releases[0]}"
+fi
+unzip_release "$(basename "${releases[0]}")"
+test_release
+echo "--------------------------------------------"
+echo "Testing upgrade from the first release to the development branch."
+printf "\n"
+
+if [ ! -f "releases/owncast-develop-linux-64bit.zip" ]; then
+ build_development
+fi
+unzip_release owncast-develop-linux-64bit.zip
+test_release
+
+echo "Done."