From 6a9af9c5140977832cad64464ff08948046900e7 Mon Sep 17 00:00:00 2001 From: dingo Date: Tue, 20 Oct 2026 18:22:44 -0400 Subject: [PATCH] ci: keep PostgreSQL-only tests out of the native suites; build with 4 jobs A push's diff against its before SHA counts every commit it carries, and any tests/ change selected checks, tsan and ecs. Run 475 spent 1h44m in checks for two commits that only touched tests/region_store_tests.cpp, which the native suites never build. Sources compiled only into evo-postgres-tests now select the PostgreSQL suites alone; the PostgreSQL image runs the repository format check so they stay formatted. Native CI stages compile with CI_BUILD_JOBS (default 4, previously a fixed 2). Co-Authored-By: Claude Opus 5.5 --- deploy/docker/Dockerfile | 25 ++++++++++++------- .../region/dev-session-route/listener.yaml | 2 +- tools/ci/ci-paths-check.sh | 12 +++++++++ tools/ci/ci-paths.sh | 5 ++++ tools/ci/linux-check.sh | 6 +++-- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index 1e62065..fe83425 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -16,6 +16,10 @@ RUN dpkg-query -W # Keep expensive compiler/package layers independent from source changes. FROM ci-toolchain AS ci-source +# Compile parallelism for the native CI stages; each clang analysis/ASan job can take +# 1-2 GiB, so raising it needs matching runner memory. +ARG CI_BUILD_JOBS=4 +ENV CI_BUILD_JOBS=${CI_BUILD_JOBS} COPY CMakeLists.txt CMakePresets.json .clang-format .clang-tidy ./ COPY cmake/ cmake/ COPY include/ include/ @@ -31,7 +35,7 @@ RUN bash tools/ci/linux-check.sh checks FROM ci-source AS ci-tsan RUN cmake --preset tsan -DCMAKE_CXX_COMPILER=clang++-19 \ - && cmake --build --preset tsan --parallel 2 + && cmake --build --preset tsan --parallel "${CI_BUILD_JOBS}" CMD ["ctest", "--preset", "tsan", "--no-tests=error", "--timeout", "120"] FROM ci-source AS ci-client @@ -45,13 +49,13 @@ RUN cmake -P tools/prepare-sdl3.cmake \ && cmake -P tools/prepare-imgui.cmake \ && cmake --preset client-probe -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_C_COMPILER=clang-19 \ -DEVO_BUILD_CLIENT=ON -DEVO_BUILD_UI_PROBE=ON -DEVO_ENABLE_TIDY=ON -DSDL_X11=ON -DSDL_WAYLAND=OFF \ - && cmake --build build/client-probe --target evo-client-state-tests evo-ui-probe evo-client-probe evo-client evo-client-lifecycle-tests evo-client-environment-tests evo-client-organism-tests evo-client-ui-model-tests evo-client-panel-tests evo-client-bindings-tests evo-client-auth-tests --parallel 2 \ + && cmake --build build/client-probe --target evo-client-state-tests evo-ui-probe evo-client-probe evo-client evo-client-lifecycle-tests evo-client-environment-tests evo-client-organism-tests evo-client-ui-model-tests evo-client-panel-tests evo-client-bindings-tests evo-client-auth-tests --parallel "${CI_BUILD_JOBS}" \ && ctest --preset client-probe --no-tests=error \ && xvfb-run -a env SDL_VIDEO_DRIVER=x11 ./build/client-probe/evo-client-probe --renderer software \ && for cycle in 1 2 3; do xvfb-run -a env SDL_VIDEO_DRIVER=x11 ./build/client-probe/evo-ui-probe --renderer software --cycles 1; done \ && xvfb-run -a -s "-screen 0 1280x1024x24 -noreset" env SDL_VIDEO_DRIVER=x11 ./build/client-probe/evo-client-lifecycle-tests \ && cmake --preset client-probe -DEVO_BUILD_CLIENT=ON -DEVO_SANITIZER=address -DEVO_ENABLE_TIDY=OFF \ - && cmake --build build/client-probe --target evo-client-state-tests evo-ui-probe evo-client evo-client-lifecycle-tests evo-client-environment-tests evo-client-organism-tests evo-client-ui-model-tests evo-client-panel-tests evo-client-bindings-tests evo-client-auth-tests --parallel 2 \ + && cmake --build build/client-probe --target evo-client-state-tests evo-ui-probe evo-client evo-client-lifecycle-tests evo-client-environment-tests evo-client-organism-tests evo-client-ui-model-tests evo-client-panel-tests evo-client-bindings-tests evo-client-auth-tests --parallel "${CI_BUILD_JOBS}" \ && ctest --preset client-probe --no-tests=error \ && for cycle in 1 2 3; do xvfb-run -a env SDL_VIDEO_DRIVER=x11 ./build/client-probe/evo-ui-probe --renderer software --cycles 1; done \ && xvfb-run -a -s "-screen 0 1280x1024x24 -noreset" env SDL_VIDEO_DRIVER=x11 ./build/client-probe/evo-client-lifecycle-tests @@ -62,25 +66,25 @@ FROM ci-source AS ci-network RUN cmake -P tools/prepare-mbedtls.cmake \ && cmake --preset network -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_C_COMPILER=clang-19 \ -DEVO_ENABLE_TIDY=ON \ - && cmake --build --preset network --parallel 2 \ + && cmake --build --preset network --parallel "${CI_BUILD_JOBS}" \ && ctest --preset network --no-tests=error \ && cmake --preset network -DEVO_SANITIZER=address -DEVO_ENABLE_TIDY=OFF \ - && cmake --build --preset network --parallel 2 \ + && cmake --build --preset network --parallel "${CI_BUILD_JOBS}" \ && ctest --preset network --no-tests=error FROM ci-source AS ci-ecs # Explicit experiment preparation; normal configure/runtime remains dependency-free. RUN cmake -P tools/prepare-entt.cmake \ && cmake --preset release -B build/ecs -DCMAKE_CXX_COMPILER=g++-14 -DEVO_BUILD_ECS_EXPERIMENT=ON \ - && cmake --build build/ecs --target evo-ecs-experiment --parallel 2 \ + && cmake --build build/ecs --target evo-ecs-experiment --parallel "${CI_BUILD_JOBS}" \ && ctest --test-dir build/ecs -R ecs-experiment --output-on-failure --no-tests=error \ && ./build/ecs/evo-ecs-experiment --measure \ && stat -c 'experiment_executable_bytes=%s' build/ecs/evo-ecs-experiment RUN cmake --preset asan -B build/ecs-asan -DCMAKE_CXX_COMPILER=clang++-19 -DEVO_BUILD_ECS_EXPERIMENT=ON \ - && cmake --build build/ecs-asan --target evo-ecs-experiment --parallel 2 \ + && cmake --build build/ecs-asan --target evo-ecs-experiment --parallel "${CI_BUILD_JOBS}" \ && ctest --test-dir build/ecs-asan -R ecs-experiment --output-on-failure --no-tests=error RUN cmake --preset analysis -B build/ecs-analysis -DCMAKE_CXX_COMPILER=clang++-19 -DEVO_BUILD_ECS_EXPERIMENT=ON \ - && cmake --build build/ecs-analysis --target evo-ecs-experiment --parallel 2 \ + && cmake --build build/ecs-analysis --target evo-ecs-experiment --parallel "${CI_BUILD_JOBS}" \ && ctest --test-dir build/ecs-analysis -R ecs-experiment --output-on-failure --no-tests=error # M8.2 offline deployment-policy check (ADR-0069): Ubuntu's python3-yaml only, no @@ -145,6 +149,9 @@ RUN cmake --preset release -B build/postgres -DCMAKE_CXX_COMPILER=g++-14 \ FROM postgres-build AS postgres-test-build ARG PG_BUILD_JOBS=6 +# PostgreSQL-only test changes skip the native checks job (tools/ci/ci-paths.sh), so the +# repository format check also runs here. +RUN cmake -DFORMATTER=clang-format-19 -DSOURCE_ROOT=/source -P tools/check-format.cmake RUN cmake --build build/postgres --target evo-postgres-tests --parallel "${PG_BUILD_JOBS}" RUN cmake --preset analysis -B build/postgres-analysis -DCMAKE_CXX_COMPILER=clang++-19 \ -DCMAKE_C_COMPILER=clang-19 -DEVO_BUILD_NETWORK=ON \ @@ -208,7 +215,7 @@ ENTRYPOINT ["/usr/local/bin/evo-server"] FROM ci-source AS build RUN cmake --preset release -B build/container \ -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/opt/evo/bin \ - && cmake --build build/container --parallel 2 \ + && cmake --build build/container --parallel "${CI_BUILD_JOBS}" \ && ctest --test-dir build/container --output-on-failure --no-tests=error --timeout 120 RUN dpkg-query -W > /opt/evo/build-packages.txt diff --git a/deploy/kubernetes/region/dev-session-route/listener.yaml b/deploy/kubernetes/region/dev-session-route/listener.yaml index de0ed10..4689016 100644 --- a/deploy/kubernetes/region/dev-session-route/listener.yaml +++ b/deploy/kubernetes/region/dev-session-route/listener.yaml @@ -12,7 +12,7 @@ spec: env: - {name: REGION_SESSION, value: "dev"} - {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"} - - {name: REGION_SESSION_WINDOW, value: "dev-20261020T200712-bbf338a2:1792541232"} + - {name: REGION_SESSION_WINDOW, value: "dev-20261020T221544-e8dbeb83:1792548944"} - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"} ports: # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. diff --git a/tools/ci/ci-paths-check.sh b/tools/ci/ci-paths-check.sh index 4605e84..db12a01 100644 --- a/tools/ci/ci-paths-check.sh +++ b/tools/ci/ci-paths-check.sh @@ -67,6 +67,18 @@ ops_contract_base="$(git rev-parse HEAD)" echo contract > tests/region_ops_tests.cpp git add .; git commit -qm region-ops-contract expect "push: region ops contract runs server image" 0 CI_EVENT=push "CI_BEFORE=$ops_contract_base" -- server-image +# A PostgreSQL-only test runs the PostgreSQL suite, not the native suites that never build it. +postgres_test_base="$(git rev-parse HEAD)" +echo contract > tests/region_store_tests.cpp +git add .; git commit -qm region-store-test +expect "push: postgres-only test runs postgres" 0 CI_EVENT=push "CI_BEFORE=$postgres_test_base" -- postgres +expect "push: postgres-only test skips checks" 1 CI_EVENT=push "CI_BEFORE=$postgres_test_base" -- checks +expect "push: postgres-only test skips tsan" 1 CI_EVENT=push "CI_BEFORE=$postgres_test_base" -- tsan +native_test_base="$(git rev-parse HEAD)" +echo contract > tests/region_store_tests.cpp +echo contract > tests/photosynthesis_tests.cpp +git add .; git commit -qm mixed-tests +expect "push: a native test with it still runs checks" 0 CI_EVENT=push "CI_BEFORE=$native_test_base" -- checks # Client dependency updates must select the isolated client gate. mkdir -p tools client_base="$(git rev-parse HEAD)" diff --git a/tools/ci/ci-paths.sh b/tools/ci/ci-paths.sh index e0dca76..fa827d3 100755 --- a/tools/ci/ci-paths.sh +++ b/tools/ci/ci-paths.sh @@ -31,6 +31,10 @@ fi # Every suite runs when the workflow or this selector changes. common='\.gitea/workflows/|tools/ci/ci-paths\.sh' native='CMakeLists\.txt|CMakePresets\.json|cmake/|include/|src/|apps/' +# Sources compiled only into evo-postgres-tests (CMakeLists.txt). The native suites never +# build them, so a change to one alone selects the PostgreSQL suites, not checks/tsan/ecs; +# the PostgreSQL image runs the repository format check for them instead. +postgres_only_tests='tests/(postgres_tests|region_lease_store_tests|cellular_publication_tests|population_publication_tests|environment_publication_tests|account_control_store_tests|probe_handoff_store_tests|life_reservation_store_tests|primitive_publication_tests|region_action_tests|region_checkpoint_store_tests|region_host_tests|region_server_process_tests|region_recovery_tests|region_ops_tests|region_clone_tests|region_migration_tests|region_store_tests|region_load_tests|region_upgrade_tests|region_session_tests|grant_broker_tests|region_m10_session_tests|region_handoff_process_tests|fixtures/postgres_relay)\.cpp' postgres_tools='migrations/|tools/prepare-postgres\.sh|tools/migrate-postgres\.sh|tools/backup/|tools/ci/postgres-check\.sh|tools/ci/life-reservations-|tools/ci/backup-check\.sh|tools/ci/dr-check\.sh|tools/ci/upgrade-check\.sh' case "$suite" in client) @@ -41,6 +45,7 @@ case "$suite" in ;; checks|tsan|ecs) pattern="$common|$native|tests/|experiments/|tools/ci/linux-check\.sh|tools/ci/tsan-profile\.mjs|deploy/docker/Dockerfile" + files=$(grep -Ev "^($postgres_only_tests)$" <<< "$files" || true) ;; postgres|postgres-tools) pattern="$common|$native|tests/|$postgres_tools|third_party/mbedtls/|tools/prepare-mbedtls\.cmake|tools/mbedtls-pin\.cmake|deploy/docker/Dockerfile" diff --git a/tools/ci/linux-check.sh b/tools/ci/linux-check.sh index eaff8e5..5a2bf8e 100644 --- a/tools/ci/linux-check.sh +++ b/tools/ci/linux-check.sh @@ -3,6 +3,8 @@ set -euo pipefail # Run inside the Dockerfile's ci-toolchain stage, not an arbitrary host shell. suite="${1:?Expected checks or tsan}" +# Compile parallelism; each clang analysis/ASan job can take 1-2 GiB of runner memory. +jobs="${CI_BUILD_JOBS:-4}" cmake --version g++-14 --version clang++-19 --version @@ -14,7 +16,7 @@ check_preset() { local preset="$1" local compiler="$2" cmake --preset "$preset" "-DCMAKE_CXX_COMPILER=$compiler" - cmake --build --preset "$preset" --parallel 2 + cmake --build --preset "$preset" --parallel "$jobs" ctest --preset "$preset" --no-tests=error --timeout 120 } @@ -31,7 +33,7 @@ case "$suite" in cmake --preset debug -B build/fuzz -DCMAKE_CXX_COMPILER=clang++-19 \ -DEVO_BUILD_FUZZER=ON - cmake --build build/fuzz --target evo-snapshot-fuzz evo-world-codec-fuzz --parallel 2 + cmake --build build/fuzz --target evo-snapshot-fuzz evo-world-codec-fuzz --parallel "$jobs" ./build/fuzz/evo-world-codec-fuzz -seed=123456 -runs=10000 \ -max_len=96 -timeout=10 -rss_limit_mb=1024 mkdir -p build/fuzz/corpus