Skip to content

Commit b80bd71

Browse files
committed
add cache
1 parent 5866105 commit b80bd71

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/build-cpack-packages.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,18 @@ jobs:
3131
linux:
3232
name: Linux packages
3333
runs-on: ubuntu-22.04
34+
env:
35+
BUILD_CACHE_KEY: ${{ runner.os }}-cpack-${{ inputs.build-type }}-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'include/**', 'src/**', 'scylla-rust-wrapper/Cargo.toml', 'scylla-rust-wrapper/Cargo.lock') }}
3436
steps:
3537
- uses: actions/checkout@v4
38+
- name: Restore build cache
39+
uses: actions/cache/restore@v4
40+
id: restore-build
41+
with:
42+
path: build
43+
key: ${{ env.BUILD_CACHE_KEY }}
44+
restore-keys: |
45+
${{ runner.os }}-cpack-${{ inputs.build-type }}-
3646
- name: Install tooling
3747
run: |
3848
sudo apt-get update
@@ -59,12 +69,28 @@ jobs:
5969
name: linux-packages
6070
path: artifacts/linux
6171
retention-days: 7
72+
- name: Save build cache
73+
if: steps.restore-build.outputs.cache-hit != 'true'
74+
uses: actions/cache/save@v4
75+
with:
76+
path: build
77+
key: ${{ env.BUILD_CACHE_KEY }}
6278

6379
macos:
6480
name: macOS packages
6581
runs-on: macos-13
82+
env:
83+
BUILD_CACHE_KEY: ${{ runner.os }}-cpack-${{ inputs.build-type }}-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'include/**', 'src/**', 'scylla-rust-wrapper/Cargo.toml', 'scylla-rust-wrapper/Cargo.lock') }}
6684
steps:
6785
- uses: actions/checkout@v4
86+
- name: Restore build cache
87+
uses: actions/cache/restore@v4
88+
id: restore-build
89+
with:
90+
path: build
91+
key: ${{ env.BUILD_CACHE_KEY }}
92+
restore-keys: |
93+
${{ runner.os }}-cpack-${{ inputs.build-type }}-
6894
- name: Configure
6995
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} ${{ inputs.extra-cmake-flags }}
7096
- name: Build
@@ -87,12 +113,28 @@ jobs:
87113
name: macos-packages
88114
path: artifacts/macos
89115
retention-days: 7
116+
- name: Save build cache
117+
if: steps.restore-build.outputs.cache-hit != 'true'
118+
uses: actions/cache/save@v4
119+
with:
120+
path: build
121+
key: ${{ env.BUILD_CACHE_KEY }}
90122

91123
windows:
92124
name: Windows packages
93125
runs-on: windows-2022
126+
env:
127+
BUILD_CACHE_KEY: ${{ runner.os }}-cpack-${{ inputs.build-type }}-${{ hashFiles('CMakeLists.txt', 'cmake/**', 'include/**', 'src/**', 'scylla-rust-wrapper/Cargo.toml', 'scylla-rust-wrapper/Cargo.lock') }}
94128
steps:
95129
- uses: actions/checkout@v4
130+
- name: Restore build cache
131+
uses: actions/cache/restore@v4
132+
id: restore-build
133+
with:
134+
path: build
135+
key: ${{ env.BUILD_CACHE_KEY }}
136+
restore-keys: |
137+
${{ runner.os }}-cpack-${{ inputs.build-type }}-
96138
- name: Add WiX to PATH
97139
shell: pwsh
98140
run: |
@@ -139,3 +181,9 @@ jobs:
139181
name: windows-packages
140182
path: artifacts/windows
141183
retention-days: 7
184+
- name: Save build cache
185+
if: steps.restore-build.outputs.cache-hit != 'true'
186+
uses: actions/cache/save@v4
187+
with:
188+
path: build
189+
key: ${{ env.BUILD_CACHE_KEY }}

0 commit comments

Comments
 (0)