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