Skip to content

Commit dfa37d3

Browse files
committed
[actions] Add controls for cache restore/saving
Until we figure out how to detect when we need to rebuild, allow manually controlling caching.
1 parent e8031df commit dfa37d3

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

.github/workflows/build_wheels_windows.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ name: Windows CUDA x64
1111

1212
on:
1313
workflow_dispatch:
14+
inputs:
15+
# TODO: Right now we don't correctly determine when things have changed and we require a
16+
# rebuild, so for now we just manually trigger rebuilds between runs.
17+
restore_build_cache:
18+
description: "Restore build cache. Uncheck to force re-build."
19+
required: false
20+
type: boolean
21+
default: true
22+
save_build_cache:
23+
description: "Save build cache."
24+
required: false
25+
type: boolean
26+
default: true
1427

1528

1629
jobs:
@@ -104,13 +117,18 @@ jobs:
104117
Copy-Item -Path "$CUDNN_PATH/bin/*" -Destination . -Include "*.dll"
105118
shell: pwsh
106119

107-
- name: Cache build artifacts
108-
uses: actions/cache@v3
120+
# TODO: This isn't the correct cache key since it relies on the CMake options we build with.
121+
# This is good enough for now though to cache build artifacts; we can manually skip restoring
122+
# the cache to rebuild it.
123+
- name: Restore build artifacts
124+
uses: actions/cache/restore@v3
125+
if: ${{ inputs.restore_build_cache }}
109126
with:
110127
path: _skbuild
111128
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/CMakeLists.txt') }}
112129
restore-keys: |
113130
${{ runner.os }}-${{ matrix.python-version }}-
131+
114132
- name: Build a package
115133
# CMake 3.25 regression fix. See https://stackoverflow.com/questions/74162633/problem-compiling-from-source-opencv-with-mvsc2019-in-64-bit-version
116134
run: |
@@ -125,6 +143,13 @@ jobs:
125143
}
126144
python setup.py $SKIP_CMAKE bdist_wheel --py-limited-api=cp37 --dist-dir="$PWD\wheelhouse" -v
127145
shell: pwsh
146+
147+
- name: Save build artifacts to cache
148+
uses: actions/cache/save@v3
149+
if: ${{ inputs.save_build_cache }}
150+
with:
151+
path: _skbuild
152+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/CMakeLists.txt') }}
128153
- name: Saving all wheels
129154
uses: actions/upload-artifact@v4
130155
with:

0 commit comments

Comments
 (0)