From bed046e7ed1af33ecff03d048aaf60bf13fab082 Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Thu, 15 Jan 2026 17:20:19 +0300 Subject: [PATCH] feat(tests): update Dockerfile and CI script for parallel builds and improved caching --- Dockerfile.arch | 2 + Dockerfile.debian | 2 + Dockerfile.fedora | 4 ++ Dockerfile.tumbleweed | 4 ++ Dockerfile.ubuntu | 2 + ci-build.sh | 95 ++++++++++++++++++++++++++++++++----------- 6 files changed, 86 insertions(+), 23 deletions(-) diff --git a/Dockerfile.arch b/Dockerfile.arch index da3d77bf..3b3e7f14 100644 --- a/Dockerfile.arch +++ b/Dockerfile.arch @@ -1,6 +1,7 @@ FROM archlinux ENV TERM=xterm +ENV CC="ccache gcc" RUN pacman -Syu --noconfirm # 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 \ automake \ base-devel \ + ccache \ check \ cmake \ cmocka \ diff --git a/Dockerfile.debian b/Dockerfile.debian index a80f2d2b..bbeb7bab 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -3,11 +3,13 @@ FROM debian:testing ENV DEBIAN_FRONTEND="noninteractive" ENV TERM=xterm +ENV CC="ccache gcc" RUN apt-get update && apt-get install -y --no-install-recommends \ autoconf \ autoconf-archive \ automake \ + ccache \ gcc \ git \ libcmocka-dev \ diff --git a/Dockerfile.fedora b/Dockerfile.fedora index 412e0a4f..6fd4013e 100644 --- a/Dockerfile.fedora +++ b/Dockerfile.fedora @@ -1,6 +1,9 @@ # Build the latest Fedora image FROM fedora:latest +ENV TERM=xterm +ENV CC="ccache gcc" + # libmicrohttpd - for stabber # glibc-locale - to have en_US locale RUN dnf install -y \ @@ -8,6 +11,7 @@ RUN dnf install -y \ autoconf-archive \ automake \ awk \ + ccache \ gcc \ git \ glib2-devel \ diff --git a/Dockerfile.tumbleweed b/Dockerfile.tumbleweed index b8354229..bd9e69f2 100644 --- a/Dockerfile.tumbleweed +++ b/Dockerfile.tumbleweed @@ -1,12 +1,16 @@ # Build the latest openSUSE Tumbleweed image FROM opensuse/tumbleweed +ENV TERM=xterm +ENV CC="ccache gcc" + # libmicrohttpd - for stabber # glibc-locale - to have en_US locale RUN zypper --non-interactive in --no-recommends \ autoconf \ autoconf-archive \ automake \ + ccache \ gcc \ git \ glib2-devel \ diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index edc2cdd6..f89ec5ea 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -2,11 +2,13 @@ FROM ubuntu:latest ENV DEBIAN_FRONTEND="noninteractive" ENV TERM=xterm +ENV CC="ccache gcc" RUN apt-get update && apt-get install -y --no-install-recommends \ autoconf \ autoconf-archive \ automake \ + ccache \ gcc \ git \ libcmocka-dev \ diff --git a/ci-build.sh b/ci-build.sh index 439fb2e0..03a9572f 100755 --- a/ci-build.sh +++ b/ci-build.sh @@ -44,7 +44,7 @@ ARCH="$(uname | tr '[:upper:]' '[:lower:]')" case "$ARCH" in linux*) - # Reduced set of configurations for faster CI + # 4 configurations for parallel CI tests=( # 1. Full build (all features enabled) "--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" # 3. No encryption (disable otr, pgp, omemo) "--disable-pgp --disable-otr --disable-omemo --disable-omemo-qrcode" - # 4. No plugins - "--disable-plugins --disable-c-plugins --disable-python-plugins" - # 5. Default configuration + # 4. Default configuration "" ) source /etc/profile.d/debuginfod.sh 2>/dev/null || true ;; darwin*) - # Reduced set of configurations for faster CI + # 4 configurations for parallel CI tests=( # 1. Full build (all features enabled) "--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp @@ -76,9 +74,7 @@ case "$ARCH" in --disable-python-plugins" # 3. No encryption (disable otr, pgp, omemo) "--disable-pgp --disable-otr --disable-omemo" - # 4. No plugins - "--disable-plugins --disable-c-plugins --disable-python-plugins" - # 5. Default configuration + # 4. 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 CC="egcc -std=gnu99 -fexec-charset=UTF-8" - # Reduced set of configurations for faster CI + # 4 configurations for parallel CI tests=( # 1. Full build (all features enabled) "--enable-notifications --enable-icons-and-clipboard --enable-otr --enable-pgp @@ -102,9 +98,7 @@ case "$ARCH" in --disable-python-plugins" # 3. No encryption (disable otr, pgp, omemo) "--disable-pgp --disable-otr --disable-omemo" - # 4. No plugins - "--disable-plugins --disable-c-plugins --disable-python-plugins" - # 5. Default configuration + # 4. Default configuration "" ) ;; @@ -129,18 +123,73 @@ case "$ARCH" in ;; esac -for features in "${tests[@]}" -do - echo - echo "--> Building with ./configure ${features} $*" - echo +# Function to build and test a single configuration +build_and_test() { + local features="$1" + local extra_args="$2" + 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}" - $MAKE check-functional-parallel + mkdir -p "$build_dir" + cd "$build_dir" - ./profanity -v - $MAKE clean + # shellcheck disable=SC2086 + ../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 + +# 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