diff --git a/.github/scripts/run_scheduled_tests.sh b/.github/scripts/run_scheduled_tests.sh new file mode 100755 index 000000000..810bdba14 --- /dev/null +++ b/.github/scripts/run_scheduled_tests.sh @@ -0,0 +1,117 @@ +#!/bin/sh -eu +# +# THis scripts is called by .github/workflows/semi-weeekly_tests.yml +# The idea is to do some further functional UltraGrid tests + +# see also (taken from) .github/scripts/Linux/utils/Dockerfile.ubuntu +ubuntu_packages=" + libasound2t64\ + libegl1\ + libfontconfig1\ + libglx-mesa0\ + libgmp10\ + libharfbuzz0b\ + libopengl0\ + libp11-kit0\ + libx11-6\ + openbox\ + xvfb" + +case "$RUNNER_OS" in + Linux) + sudo apt update + sudo apt -y install $ubuntu_packages + Xvfb :99 -screen 0 1920x1080x24 & + export DISPLAY=:99 + openbox & + + ug_build=UltraGrid-continuous-x86_64.AppImage + prepare() { + chmod +x "$ug_build" + ./"$ug_build" --appimage-extract + } + run_uv=squashfs-root/AppRun + run_reflector="squashfs-root/AppRun -o hd-rum-transcode" + ;; + Windows) + ug_build=UltraGrid-continuous-win64.zip + prepare() { + unzip "$ug_build" + } + run_uv=UltraGrid-continuous-win64/uv.exe + run_reflector=UltraGrid-continuous-win64/hd-rum-transcode.exe + ;; + macOS) + ug_build=UltraGrid-continuous-arm64.dmg + prepare() { + hdiutil mount "$ug_build" + } + brew install coreutils + alias timeout=gtimeout + run_uv=/Volumes/ULTRAGRID/uv-qt.app/Contents/MacOS/uv + run_reflector=/Volumes/ULTRAGRID/uv-qt.app/Contents/MacOS/\ +hd-rum-transcode +esac + +curl -LOf https://github.com/CESNET/UltraGrid/releases/download/continuous/\ +"$ug_build" + +prepare + +## used by run_test_data.sh +## @param $1 args +## @param $2 opts (optional, separated by comma): +## - should_fail - expected outcome of the command is failure +## - should_timeout - the command is expected to keep running +## (will be terminated by timeout) +## - run_reflector - instead of uv, pass the args to hd-rum-transcode +add_test() { + eval "test_${test_count}_args=\${1?}" + eval "test_${test_count}_opts=\${2-}" + test_count=$((test_count + 1)) +} + +test_count=0 +. "$(dirname "$0")"/run_scheduled_tests_data.sh + +set +e +i=0 +while [ $i -lt $test_count ]; do + eval "args=\$test_${i}_args" + eval "opts=\$test_${i}_opts" + + exec=$run_uv + tool=uv + if expr -- "$opts" : '.*run_reflector' >/dev/null; then + tool=reflector + exec=$run_reflector + fi + + timeout=5 + timeout $timeout $exec $args + rc=$? + + if [ $rc = 124 ]; then + if ! expr -- "$opts" : '.*should_timeout' >/dev/null; then + printf "$tool with arguments %s timeout (limit: %d sec)!\n" \ + "$args" "$timeout" + exit 1 + fi + elif expr -- "$opts" : '.*should_fail' >/dev/null; then + if [ $rc -eq 0 ]; then + printf "$tool with arguments %s should have failed but\ + returned 0!\n" "$args" + exit 1 + fi + else + if [ $rc -ne 0 ]; then + printf "$tool with arguments %s returned %d but should have\ + succeeeded!\n" "$args" "$rc" + exit 1 + fi + + fi + + i=$((i + 1)) +done + diff --git a/.github/scripts/run_scheduled_tests_data.sh b/.github/scripts/run_scheduled_tests_data.sh new file mode 100644 index 000000000..0defd0342 --- /dev/null +++ b/.github/scripts/run_scheduled_tests_data.sh @@ -0,0 +1,14 @@ +# test cases for run_scheduled_tests.sh +# +# For the documentation of add_test parameters see the +# run_scheduled_tests.sh file. + +# UltraGrid +add_test -v # basic sanity test +add_test --nonexistent-param should_fail +add_test "-d sdl" should_timeout +add_test "-t testcard -c lavc:e=libx265 -f rs -d dummy" should_timeout + +# reflector +add_test -v run_reflector # basic sanity test +add_test "8M 5004" run_reflector,should_timeout diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml index ef99aeb1f..ac54b2cd9 100644 --- a/.github/workflows/coverity-scan.yml +++ b/.github/workflows/coverity-scan.yml @@ -9,6 +9,7 @@ on: jobs: Coverity: + # run by cron only in CESNET/UltraGrid, on push to coverity_scan anywhere if: github.repository == 'CESNET/UltraGrid' || github.event.schedule == null runs-on: ubuntu-latest env: diff --git a/.github/workflows/semi-weekly_tests.yml b/.github/workflows/semi-weekly_tests.yml new file mode 100644 index 000000000..7c82a2d33 --- /dev/null +++ b/.github/workflows/semi-weekly_tests.yml @@ -0,0 +1,27 @@ +name: Continuous build semi-weekly tests + +on: + push: + branches: + - run_tests + schedule: + - cron: '00 13 * * 1,5' # Mo,Fr at 13:00 UTC + +jobs: + run_tests: + # run by cron only in CESNET/UltraGrid, on push to run_tests anywhere + if: github.repository == 'CESNET/UltraGrid' || github.event.schedule == null + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + runs-on: ${{ matrix.os }} + defaults: + run: + shell: ${{ matrix.os == 'windows-latest' && 'C:\shells\msys2bash.cmd {0}' || 'bash {0}' }} + + steps: + - uses: actions/checkout@v4 + - name: Run + shell: bash + run: .github/scripts/run_scheduled_tests.sh