Skip to content

Commit 3418689

Browse files
committed
add CI tests
1 parent 258b598 commit 3418689

3 files changed

Lines changed: 101 additions & 0 deletions

File tree

.github/scripts/run_tests.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/sh -eu
2+
3+
case "$RUNNER_OS" in
4+
Linux)
5+
ug_build=UltraGrid-continuous-x86_64.AppImage
6+
prepare() {
7+
chmod +x "$ug_build"
8+
./"$ug_build" --appimage-extract
9+
}
10+
run=squashfs-root/AppRun
11+
;;
12+
Windows)
13+
ug_build=UltraGrid-continuous-win64.zip
14+
prepare() {
15+
unzip "$ug_build"
16+
}
17+
run=UltraGrid-continuos-win64/uv.exe
18+
;;
19+
macOS)
20+
ug_build=UltraGrid-continuous-arm64.dmg
21+
prepare() {
22+
hdiutil mount "$ug_build"
23+
}
24+
run=/Volumes/ULTRAGRID/uv-qt.app/Contents/MacOS/uv
25+
esac
26+
27+
curl -LOf https://github.com/CESNET/UltraGrid/releases/download/continuous/\
28+
"$ug_build"
29+
30+
prepare
31+
32+
## used by run_test_data.sh
33+
## @param $1 args
34+
## @param $2 timeout
35+
## @param $3 opts (optional) - should_fail
36+
add_test() {
37+
set -- "$@" "$1" "$2" "${3-}"
38+
}
39+
40+
. "$(dirname "$0")"/run_test_data.sh
41+
42+
set -e
43+
while [ $# -ge 3 ]; do
44+
args=$1
45+
timeout=$2
46+
opts=$3
47+
48+
timeout "$timeout" "$run" "$args"
49+
rc=$?
50+
51+
if [ $rc = 124 ]; then
52+
printf "UG with arguments %s timeout (limit: %d sec)!\n" \
53+
"$args" "$timeout"
54+
exit 1
55+
fi
56+
57+
if expr -- "$opts" : shoulld_fail; then
58+
if [ $rc -eq 0 ]; then
59+
printf "UG with arguments %s should have failed but\
60+
returned 0!\n" "$args"
61+
exit 1
62+
fi
63+
else
64+
if [ $rc -ne 0 ]; then
65+
printf "UG with arguments %s returned %d!\n" "$args" "$rc"
66+
exit 1
67+
fi
68+
69+
fi
70+
71+
shift 3
72+
done
73+

.github/scripts/run_tests_data.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test -v 5 # basic sanity test
2+
add_test --nonexistent-param 5 should_fail
3+

.github/workflows/daily_tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Continuous daily build tests
2+
3+
on:
4+
push:
5+
branches:
6+
- run_tests
7+
schedule:
8+
- cron: '30 4 * * *' # every day at 4:30 UTC
9+
10+
jobs:
11+
run_tests:
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, windows-latest, macos-latest]
15+
16+
runs-on: ${{ matrix.os }}
17+
defaults:
18+
run:
19+
shell: ${{ matrix.os == 'windows-latest' && 'C:\shells\msys2bash.cmd {0}' || 'bash {0}' }}
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Run
24+
shell: bash
25+
run: .github/scripts/run_tests.sh

0 commit comments

Comments
 (0)