Skip to content

Commit 8b13221

Browse files
committed
CI Linux: run Docker tests in parallel
1 parent 9e7f643 commit 8b13221

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/scripts/Linux/docker_appimage_tests.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,31 @@
33
mkdir aitest-context # empty build context
44
./UltraGrid-"$VERSION"-x86_64.AppImage --appimage-extract
55

6-
for n in archlinux:latest ubuntu:22.04 ubuntu:latest; do
7-
image_name=$(echo $n | cut -d: -f 1)
8-
image_version=$(echo $n | cut -d: -f 2)
6+
run_docker_test() {
7+
image_name=$(echo "$1" | cut -d: -f 1)
8+
image_version=$(echo "$1" | cut -d: -f 2)
99
dockerfile=$(mktemp)
1010
cat .github/scripts/Linux/utils/Dockerfile."$image_name" |
1111
sed "/FROM /s/:\$/$image_version/" > "$dockerfile"
12-
docker build -f "$dockerfile" -t aitest-$n aitest-context
13-
docker run --rm -v "$PWD"/squashfs-root/:/AppImage aitest-$n sh -ce '
12+
docker build -f "$dockerfile" -t aitest-"$1" aitest-context
13+
docker run --rm -v "$PWD"/squashfs-root/:/AppImage aitest-"$1" sh -ce '
1414
/AppImage/AppRun -v
1515
/AppImage/AppRun --tool uv-qt -h
1616
xvfb-run /AppImage/AppRun --tool uv-qt & { sleep 10; kill $!; }
1717
/AppImage/AppRun --list-modules
1818
/AppImage/AppRun --capabilities
1919
'
20+
}
21+
22+
test_list="archlinux:latest ubuntu:22.04 ubuntu:latest"
23+
24+
# run the Docker tests in parallel to lower the time
25+
for n in $test_list; do
26+
run_docker_test "$n" &
27+
name=$(printf "%s" "$n" | tr -c '[:alnum:]' '[_*]') # replace :. with _ for valid identifer
28+
eval "${name}_pid"=$!
29+
done
30+
for n in $test_list; do
31+
name=$(printf "%s" "$n" | tr -c '[:alnum:]' '[_*]')
32+
eval wait "\$${name}_pid"
2033
done

0 commit comments

Comments
 (0)