Skip to content

Commit 84fa30f

Browse files
cpsievertclaude
andauthored
ci: fix sccache C++ caching on Windows for Python builds (#174)
* ci: build Python wheel once per OS, test across Python versions Split the Python CI workflow into build and test phases. The build job compiles the abi3 wheel once per OS, then test jobs download and install it across Python 3.10-3.13. This avoids redundant Rust compilation — particularly on Windows where builds take ~30 min each. Also removes path filters so Python tests run on all repo changes, since the build overhead is now minimal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: use Python 3.11 for wheel build step Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Revert "ci: use Python 3.11 for wheel build step" This reverts commit d8b29c5. * ci: set CC_WRAPPER=sccache to cache C/C++ builds on Windows sccache sees zero C/C++ compilations on Windows because the cc crate doesn't auto-detect sccache as a compiler wrapper with MSVC. Setting CC_WRAPPER=sccache explicitly routes cl.exe calls through sccache, enabling caching of DuckDB and other C/C++ dependency builds. The first run will still be slow (all cache misses), but subsequent runs should benefit from ~300 cached C/C++ compilation results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: use CC/CXX=sccache cl on Windows to cache DuckDB C++ builds CC_WRAPPER didn't work because the cc crate doesn't check that env var. The real issue: when the cc crate finds MSVC cl.exe via find_msvc_tools, it bypasses the RUSTC_WRAPPER-based sccache fallback that works on Linux. Setting CC/CXX='sccache cl' on Windows makes the cc crate's env_tool parser recognize "sccache" as a known wrapper and "cl" as the compiler. This routes the ~21-minute libduckdb-sys C++ build through sccache. First run will still be slow (cache seeding), but subsequent runs should see C/C++ cache hits and significantly faster Windows builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: use ilammy/msvc-dev-cmd to put cl.exe on PATH for sccache The previous attempt failed because sccache couldn't find bare 'cl' - MSVC tools aren't on PATH by default. ilammy/msvc-dev-cmd runs vcvarsall to set up the MSVC environment, putting cl.exe on PATH so that 'sccache cl' works as a CC/CXX wrapper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: simplify back to single test job now that sccache caches C++ on Windows Remove the build/test split since sccache should make Windows builds fast enough (~5 min) that compiling per Python version is acceptable. The diff from main is now minimal: remove path filters, add MSVC setup + CC/CXX env vars for sccache C++ caching on Windows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 254a2b0 commit 84fa30f

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/python.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: Python
22

33
on:
44
push:
5-
paths: ['ggsql-python/**', '.github/workflows/python.yml']
65
pull_request:
7-
paths: ['ggsql-python/**', '.github/workflows/python.yml']
86

97
jobs:
108
test:
@@ -37,13 +35,25 @@ jobs:
3735
workspaces: ggsql-python
3836
shared-key: ${{ matrix.os }}-python
3937

38+
- name: Set up MSVC (Windows)
39+
if: runner.os == 'Windows'
40+
uses: ilammy/msvc-dev-cmd@v1
41+
4042
- name: Build wheel
4143
uses: PyO3/maturin-action@v1
4244
with:
4345
working-directory: ggsql-python
4446
command: build
4547
args: --release
4648
sccache: true
49+
env:
50+
# On Windows/MSVC, the cc crate's cl.exe detection bypasses its
51+
# RUSTC_WRAPPER-based sccache fallback. Setting CC/CXX tells the
52+
# cc crate to parse "sccache" as a known wrapper and "cl" as the
53+
# compiler, routing DuckDB C++ builds through sccache.
54+
# ilammy/msvc-dev-cmd puts cl.exe on PATH so sccache can find it.
55+
CC: ${{ runner.os == 'Windows' && 'sccache cl' || '' }}
56+
CXX: ${{ runner.os == 'Windows' && 'sccache cl' || '' }}
4757

4858
- name: Install wheel and test dependencies
4959
shell: bash

0 commit comments

Comments
 (0)