File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9797 with :
9898 shared-key : gate
9999 save-if : ${{ github.event_name != 'pull_request' }}
100+ - name : Download the DuckDB library again if the restored cache lacks it
101+ run : scripts/refetch_duckdb_library.sh
100102 # The evidence snapshot evidence.toml pins; scripts/evidence.sh verifies it after a restore.
101103 - uses : actions/cache@v4
102104 with :
@@ -183,6 +185,8 @@ jobs:
183185 with :
184186 shared-key : duckshop
185187 save-if : ${{ github.event_name != 'pull_request' }}
188+ - name : Download the DuckDB library again if the restored cache lacks it
189+ run : scripts/refetch_duckdb_library.sh
186190 - name : Compile DuckShop and DuckShop 10K
187191 run : make duckshop-compiled
188192 - name : Convert them
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Makes Cargo download the DuckDB library again when a restored build cache lacks it.
3+ #
4+ # Usage: scripts/refetch_duckdb_library.sh; CARGO_TARGET_DIR, when set, is the target directory.
5+ # libduckdb-sys' build script downloads libduckdb.so into <target>/duckdb-download, beside the
6+ # profile directories, where a build cache such as Swatinem/rust-cache does not keep it. The cache
7+ # does keep the build script's recorded output, so Cargo would not run it again, and the build links
8+ # and copies a library that is not there. For each recorded run whose library is missing, this
9+ # removes its fingerprint, so the next build runs the build script and downloads the library.
10+ set -euo pipefail
11+ target=${CARGO_TARGET_DIR:- target}
12+ for output in " $target " /* /build/libduckdb-sys-* /output; do
13+ [ -f " $output " ] || continue
14+ library=" $( sed -n ' s/^cargo:rustc-link-search=native=\(.*duckdb-download.*\)$/\1/p' " $output " | head -1) "
15+ if [ -n " $library " ] && [ ! -f " $library /libduckdb.so" ]; then
16+ unit=" $( dirname " $output " ) "
17+ echo " refetch DuckDB library: $( basename " $unit " ) recorded $library /libduckdb.so, which is missing"
18+ rm -rf " $( dirname " $( dirname " $unit " ) " ) /.fingerprint/$( basename " $unit " ) "
19+ fi
20+ done
You can’t perform that action at this time.
0 commit comments