Skip to content

Commit 6d7204b

Browse files
committed
ci(distributions): save DuckDB's objects from the nightly, not every main run
Each save adds a cache entry of a few hundred MB per platform, and saving from every run on main would churn the repository's cache space and evict the Cargo git caches other jobs restore. Main now saves from the scheduled nightly build, and otherwise only when the restore matched no objects for this DuckDB and its settings, so a first fill or an upgrade still saves. Other pushes and release builds only restore.
1 parent 514f2da commit 6d7204b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎.github/workflows/build-distributions.yml‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,11 @@ jobs:
193193
key="$(sha256 <<< "${settings}" | cut -c 1-16)"
194194
echo "DUCKDB_CACHE_KEY=duckdb-objects-v1-${{ matrix.platform.name }}-${key}" >> "${GITHUB_ENV}"
195195
# Restored on every build, but saved only from main (below), so a release or publish build
196-
# never reads objects another branch compiled.
196+
# never reads objects another branch compiled. Main saves from the scheduled nightly build, and
197+
# otherwise only when no saved objects match this DuckDB and its settings (a first fill or an
198+
# upgrade), so the repository's cache space is not spent on a copy per push.
197199
- name: Restore DuckDB's compiled objects
200+
id: duckdb-cache
198201
if: inputs.prebuilt-run-id == ''
199202
uses: actions/cache/restore@v4
200203
with:
@@ -242,10 +245,14 @@ jobs:
242245
run: '"${CMAKE_C_COMPILER_LAUNCHER}" --stop-server'
243246
# The manylinux container writes the cache as root, and sccache keeps its files private.
244247
- name: Give the runner the container's cache files
245-
if: inputs.prebuilt-run-id == '' && runner.os == 'Linux'
248+
if: >-
249+
runner.os == 'Linux' && inputs.prebuilt-run-id == '' && github.ref == 'refs/heads/main'
250+
&& (github.event_name == 'schedule' || steps.duckdb-cache.outputs.cache-matched-key == '')
246251
run: sudo chown -R "$(id -u):$(id -g)" .sccache-cache
247252
- name: Save DuckDB's compiled objects from main
248-
if: inputs.prebuilt-run-id == '' && github.ref == 'refs/heads/main'
253+
if: >-
254+
inputs.prebuilt-run-id == '' && github.ref == 'refs/heads/main'
255+
&& (github.event_name == 'schedule' || steps.duckdb-cache.outputs.cache-matched-key == '')
249256
uses: actions/cache/save@v4
250257
with:
251258
path: .sccache-cache

0 commit comments

Comments
 (0)