From 717ab93a99ee29a6e4e8cbc385313e6facddcca3 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 03:19:39 +0300 Subject: [PATCH] ci(windows): rebuild in downstream jobs instead of reusing the build tree The runner gives each job a different workspace path, so a restored CMake cache is rejected (and its absolute paths are stale). The test and package jobs now discard the restored build state, keep only the dependency sources carried in the artifact, and rebuild from source. --- .gitea/scripts/windows-native.sh | 17 +++++++++++++++-- .gitea/workflows/ci.yml | 6 +++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.gitea/scripts/windows-native.sh b/.gitea/scripts/windows-native.sh index b3f18f9..e3899bd 100644 --- a/.gitea/scripts/windows-native.sh +++ b/.gitea/scripts/windows-native.sh @@ -43,6 +43,16 @@ if [ "${variant}" = "sanitizers" ]; then linker_flags="-fsanitize=address,undefined" fi +# Drops the stale build state (absolute paths from another workspace) while +# keeping the materialized dependency sources carried over in the artifact. +clean_build_state() { + if [ -d "${build}/_deps" ]; then + find "${build}" -mindepth 1 -maxdepth 1 ! -name '_deps' -exec rm -rf {} + + else + rm -rf "${build}" + fi +} + configure() { cmake -S . -B "${build}" -G Ninja \ -DCMAKE_BUILD_TYPE="${build_type}" \ @@ -58,13 +68,16 @@ build) cmake --build "${build}" --parallel 4 ;; test) - # The runner uses a different workspace directory per job, so the restored - # build's absolute paths are stale: reconfigure and rebuild incrementally. + # The runner uses a different workspace directory per job, so a restored + # build's absolute paths cannot be reused: rebuild from source (only the + # dependency sources are carried over in the artifact). + clean_build_state configure cmake --build "${build}" --parallel 4 ctest --test-dir "${build}" --output-on-failure --no-tests=error ;; package) + clean_build_state configure cmake --build "${build}" --parallel 4 out="dist-windows-${variant}" diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index b436d08..4343965 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -387,8 +387,12 @@ jobs: if: always() uses: actions/upload-artifact@v3 with: + # Downstream jobs rebuild (the runner's workspace path differs per job), + # so only the materialized dependency sources are worth carrying over. name: vbs-windows-build-${{ matrix.variant }} - path: build/windows-${{ matrix.variant }}/ + path: | + build/windows-${{ matrix.variant }}/_deps/voidlibrary-src/ + !build/windows-${{ matrix.variant }}/_deps/voidlibrary-src/.git/ if-no-files-found: ignore retention-days: 7