Skip to content

Commit a4099e3

Browse files
authored
retry with DISTUTILS_USE_SDK=1 + path updates
Added steps to find cl.exe and generate sccache wrapper script for Windows builds.
1 parent bd23a2b commit a4099e3

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/build-wheel.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,33 @@ jobs:
7676
if: ${{ startsWith(inputs.host-platform, 'win') }}
7777
uses: ilammy/msvc-dev-cmd@v1 # TODO: ask admin to allow pinning commits
7878

79+
# at this point, cl.exe already exists in PATH
80+
- name: Find cl.exe and set CL_EXE environment variable
81+
if: ${{ startsWith(inputs.host-platform, 'win') }}
82+
run: |
83+
# Find the full path of cl.exe
84+
CL_EXE=$(which cl.exe)
85+
if [ -z "${CL_EXE}" ]; then
86+
echo "Error: cl.exe not found in PATH"
87+
exit 1
88+
fi
89+
echo "Found cl.exe at: ${CL_EXE}"
90+
echo "CL_EXE=$(cygpath -w "${CL_EXE}")" >> $GITHUB_ENV
91+
92+
- name: Generate sccache wrapper script
93+
if: ${{ startsWith(inputs.host-platform, 'win') }}
94+
run: |
95+
# Create a wrapper directory
96+
mkdir -p sccache_wrapper
97+
# Generate the wrapper script named cl.exe
98+
cat > sccache_wrapper/cl.exe <<'EOF'
99+
@echo off
100+
sccache "%CL_EXE%" %*
101+
EOF
102+
cat sccache_wrapper/cl.exe
103+
# Record the wrapper path for later use
104+
echo "SCCACHE_WRAPPER_DIR=$(realpath "./sccache_wrapper")" >> $GITHUB_ENV
105+
79106
- name: Set environment variables
80107
env:
81108
CUDA_VER: ${{ inputs.cuda-version }}
@@ -155,9 +182,22 @@ jobs:
155182
CIBW_ENVIRONMENT_WINDOWS: >
156183
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
157184
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
185+
SCCACHE_GHA_ENABLED=true
186+
ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }}
187+
ACTIONS_RUNTIME_URL=${{ env.ACTIONS_RUNTIME_URL }}
188+
ACTIONS_RESULTS_URL=${{ env.ACTIONS_RESULTS_URL }}
189+
ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }}
190+
ACTIONS_CACHE_SERVICE_V2=${{ env.ACTIONS_CACHE_SERVICE_V2 }}
191+
SCCACHE_DIR="$(cygpath -w ${{ env.SCCACHE_DIR }})"
192+
SCCACHE_CACHE_SIZE=${{ env.SCCACHE_CACHE_SIZE }}
193+
SCCACHE_LOG=debug
194+
DISTUTILS_USE_SDK=1
195+
PATH="$(cygpath -w "${{ env.SCCACHE_WRAPPER_DIR }}");$(dirname "${{ env.SCCACHE_PATH }}");$PATH"
158196
# check cache stats before leaving cibuildwheel
159197
CIBW_BEFORE_TEST_LINUX: >
160198
"/host/${{ env.SCCACHE_PATH }}" --show-stats
199+
CIBW_BEFORE_TEST_WINDOWS: >
200+
"${{ env.SCCACHE_PATH }}" --show-stats
161201
# force the test stage to be run (so that before-test is not skipped)
162202
# TODO: we might want to think twice on adding this, it does a lot of
163203
# things before reaching this command.

0 commit comments

Comments
 (0)