feat(tests): update Dockerfile and CI script for parallel builds and improved caching

This commit is contained in:
2026-01-15 17:20:19 +03:00
parent fa17173e5c
commit bed046e7ed
6 changed files with 86 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
FROM archlinux FROM archlinux
ENV TERM=xterm ENV TERM=xterm
ENV CC="ccache gcc"
RUN pacman -Syu --noconfirm RUN pacman -Syu --noconfirm
# reflector is optional - if it fails due to network issues, continue with default mirrorlist # reflector is optional - if it fails due to network issues, continue with default mirrorlist
@@ -12,6 +13,7 @@ RUN pacman -S --needed --noconfirm \
autoconf-archive \ autoconf-archive \
automake \ automake \
base-devel \ base-devel \
ccache \
check \ check \
cmake \ cmake \
cmocka \ cmocka \

View File

@@ -3,11 +3,13 @@ FROM debian:testing
ENV DEBIAN_FRONTEND="noninteractive" ENV DEBIAN_FRONTEND="noninteractive"
ENV TERM=xterm ENV TERM=xterm
ENV CC="ccache gcc"
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \ autoconf \
autoconf-archive \ autoconf-archive \
automake \ automake \
ccache \
gcc \ gcc \
git \ git \
libcmocka-dev \ libcmocka-dev \

View File

@@ -1,6 +1,9 @@
# Build the latest Fedora image # Build the latest Fedora image
FROM fedora:latest FROM fedora:latest
ENV TERM=xterm
ENV CC="ccache gcc"
# libmicrohttpd - for stabber # libmicrohttpd - for stabber
# glibc-locale - to have en_US locale # glibc-locale - to have en_US locale
RUN dnf install -y \ RUN dnf install -y \
@@ -8,6 +11,7 @@ RUN dnf install -y \
autoconf-archive \ autoconf-archive \
automake \ automake \
awk \ awk \
ccache \
gcc \ gcc \
git \ git \
glib2-devel \ glib2-devel \

View File

@@ -1,12 +1,16 @@
# Build the latest openSUSE Tumbleweed image # Build the latest openSUSE Tumbleweed image
FROM opensuse/tumbleweed FROM opensuse/tumbleweed
ENV TERM=xterm
ENV CC="ccache gcc"
# libmicrohttpd - for stabber # libmicrohttpd - for stabber
# glibc-locale - to have en_US locale # glibc-locale - to have en_US locale
RUN zypper --non-interactive in --no-recommends \ RUN zypper --non-interactive in --no-recommends \
autoconf \ autoconf \
autoconf-archive \ autoconf-archive \
automake \ automake \
ccache \
gcc \ gcc \
git \ git \
glib2-devel \ glib2-devel \

View File

@@ -2,11 +2,13 @@ FROM ubuntu:latest
ENV DEBIAN_FRONTEND="noninteractive" ENV DEBIAN_FRONTEND="noninteractive"
ENV TERM=xterm ENV TERM=xterm
ENV CC="ccache gcc"
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \ autoconf \
autoconf-archive \ autoconf-archive \
automake \ automake \
ccache \
gcc \ gcc \
git \ git \
libcmocka-dev \ libcmocka-dev \

View File

@@ -44,7 +44,7 @@ ARCH="$(uname | tr '[:upper:]' '[:lower:]')"
case "$ARCH" in case "$ARCH" in
linux*) linux*)
# Reduced set of configurations for faster CI # 4 configurations for parallel CI
tests=( tests=(
# 1. Full build (all features enabled) # 1. Full build (all features enabled)
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp "--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
@@ -56,15 +56,13 @@ case "$ARCH" in
--disable-python-plugins --without-xscreensaver --disable-omemo-qrcode --disable-gdk-pixbuf" --disable-python-plugins --without-xscreensaver --disable-omemo-qrcode --disable-gdk-pixbuf"
# 3. No encryption (disable otr, pgp, omemo) # 3. No encryption (disable otr, pgp, omemo)
"--disable-pgp --disable-otr --disable-omemo --disable-omemo-qrcode" "--disable-pgp --disable-otr --disable-omemo --disable-omemo-qrcode"
# 4. No plugins # 4. Default configuration
"--disable-plugins --disable-c-plugins --disable-python-plugins"
# 5. Default configuration
"" ""
) )
source /etc/profile.d/debuginfod.sh 2>/dev/null || true source /etc/profile.d/debuginfod.sh 2>/dev/null || true
;; ;;
darwin*) darwin*)
# Reduced set of configurations for faster CI # 4 configurations for parallel CI
tests=( tests=(
# 1. Full build (all features enabled) # 1. Full build (all features enabled)
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp "--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
@@ -76,9 +74,7 @@ case "$ARCH" in
--disable-python-plugins" --disable-python-plugins"
# 3. No encryption (disable otr, pgp, omemo) # 3. No encryption (disable otr, pgp, omemo)
"--disable-pgp --disable-otr --disable-omemo" "--disable-pgp --disable-otr --disable-omemo"
# 4. No plugins # 4. Default configuration
"--disable-plugins --disable-c-plugins --disable-python-plugins"
# 5. Default configuration
"" ""
) )
;; ;;
@@ -90,7 +86,7 @@ case "$ARCH" in
# src/event/server_events.c:1454:19: error: universal character names are only valid in C++ and C99 # src/event/server_events.c:1454:19: error: universal character names are only valid in C++ and C99
CC="egcc -std=gnu99 -fexec-charset=UTF-8" CC="egcc -std=gnu99 -fexec-charset=UTF-8"
# Reduced set of configurations for faster CI # 4 configurations for parallel CI
tests=( tests=(
# 1. Full build (all features enabled) # 1. Full build (all features enabled)
"--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp "--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp
@@ -102,9 +98,7 @@ case "$ARCH" in
--disable-python-plugins" --disable-python-plugins"
# 3. No encryption (disable otr, pgp, omemo) # 3. No encryption (disable otr, pgp, omemo)
"--disable-pgp --disable-otr --disable-omemo" "--disable-pgp --disable-otr --disable-omemo"
# 4. No plugins # 4. Default configuration
"--disable-plugins --disable-c-plugins --disable-python-plugins"
# 5. Default configuration
"" ""
) )
;; ;;
@@ -129,18 +123,73 @@ case "$ARCH" in
;; ;;
esac esac
for features in "${tests[@]}" # Function to build and test a single configuration
do build_and_test() {
echo local features="$1"
echo "--> Building with ./configure ${features} $*" local extra_args="$2"
echo local idx="$3"
local build_dir="build-$idx"
local log_file="build-$idx.log"
# shellcheck disable=SC2086 {
./configure $features $* echo "=== Build $idx started at $(date) ==="
echo "--> Building in $build_dir with ./configure $features $extra_args"
$MAKE CC="${CC}" mkdir -p "$build_dir"
$MAKE check-functional-parallel cd "$build_dir"
./profanity -v # shellcheck disable=SC2086
$MAKE clean ../configure $features $extra_args
$MAKE CC="${CC}"
$MAKE check-functional-parallel
./profanity -v
$MAKE clean
cd ..
rm -rf "$build_dir"
echo "=== Build $idx completed at $(date) ==="
} > "$log_file" 2>&1
}
# Run all 4 configurations in parallel
echo "Starting parallel builds..."
pids=()
for idx in 1 2 3 4; do
if [ $idx -le ${#tests[@]} ]; then
build_and_test "${tests[$((idx-1))]}" "$*" "$idx" &
pids+=("$!")
echo "Started build $idx (PID: $!)"
fi
done done
# Wait for all builds and check exit codes
failed=0
for i in "${!pids[@]}"; do
idx=$((i + 1))
if wait "${pids[$i]}"; then
echo "✓ Build $idx passed"
else
echo "✗ Build $idx failed"
echo "--- Log for build $idx ---"
cat "build-$idx.log"
echo "--- End log ---"
failed=1
fi
done
# Show all logs on success too
if [ $failed -eq 0 ]; then
echo
echo "All builds passed!"
for idx in 1 2 3 4; do
if [ -f "build-$idx.log" ]; then
echo "--- Log for build $idx ---"
cat "build-$idx.log"
fi
done
else
exit 1
fi