4545 timeout-minutes : 30
4646 strategy :
4747 fail-fast : false
48+ env :
49+ SCCACHE_DIR : ${{ github.workspace }}/.sccache
50+ SCCACHE_CACHE_SIZE : " 2G"
4851 steps :
4952 - name : Checkout iceberg-cpp
5053 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -53,12 +56,30 @@ jobs:
5356 - name : Install dependencies
5457 shell : bash
5558 run : sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
59+ - name : Restore sccache cache
60+ uses : actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
61+ with :
62+ path : ${{ github.workspace }}/.sccache
63+ key : sccache-test-ubuntu-${{ github.run_id }}
64+ restore-keys : |
65+ sccache-test-ubuntu-
66+ - name : Setup sccache
67+ uses : mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
5668 - name : Build Iceberg
5769 shell : bash
5870 env :
5971 CC : gcc-14
6072 CXX : g++-14
61- run : ci/scripts/build_iceberg.sh $(pwd) ON
73+ run : ci/scripts/build_iceberg.sh $(pwd) ON ON
74+ - name : Show sccache stats
75+ shell : bash
76+ run : sccache --show-stats
77+ - name : Save sccache cache
78+ if : github.ref == 'refs/heads/main'
79+ uses : actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
80+ with :
81+ path : ${{ github.workspace }}/.sccache
82+ key : sccache-test-ubuntu-${{ github.run_id }}
6283 - name : Build Example
6384 shell : bash
6485 env :
@@ -72,14 +93,35 @@ jobs:
7293 timeout-minutes : 30
7394 strategy :
7495 fail-fast : false
96+ env :
97+ SCCACHE_DIR : ${{ github.workspace }}/.sccache
98+ SCCACHE_CACHE_SIZE : " 2G"
7599 steps :
76100 - name : Checkout iceberg-cpp
77101 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
78102 with :
79103 persist-credentials : false
104+ - name : Restore sccache cache
105+ uses : actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
106+ with :
107+ path : ${{ github.workspace }}/.sccache
108+ key : sccache-test-macos-${{ github.run_id }}
109+ restore-keys : |
110+ sccache-test-macos-
111+ - name : Setup sccache
112+ uses : mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
80113 - name : Build Iceberg
81114 shell : bash
82- run : ci/scripts/build_iceberg.sh $(pwd)
115+ run : ci/scripts/build_iceberg.sh $(pwd) OFF ON
116+ - name : Show sccache stats
117+ shell : bash
118+ run : sccache --show-stats
119+ - name : Save sccache cache
120+ if : github.ref == 'refs/heads/main'
121+ uses : actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
122+ with :
123+ path : ${{ github.workspace }}/.sccache
124+ key : sccache-test-macos-${{ github.run_id }}
83125 - name : Build Example
84126 shell : bash
85127 run : ci/scripts/build_example.sh $(pwd)/example
90132 timeout-minutes : 60
91133 strategy :
92134 fail-fast : false
135+ env :
136+ SCCACHE_DIR : ${{ github.workspace }}/.sccache
137+ SCCACHE_CACHE_SIZE : " 2G"
93138 steps :
94139 - name : Checkout iceberg-cpp
95140 uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -110,17 +155,28 @@ jobs:
110155 shell : pwsh
111156 run : |
112157 vcpkg install zlib:x64-windows nlohmann-json:x64-windows nanoarrow:x64-windows roaring:x64-windows cpr:x64-windows
158+ - name : Restore sccache cache
159+ uses : actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
160+ with :
161+ path : ${{ github.workspace }}/.sccache
162+ key : sccache-test-windows-${{ github.run_id }}
163+ restore-keys : |
164+ sccache-test-windows-
113165 - name : Setup sccache
114166 uses : mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
115167 - name : Build Iceberg
116168 shell : pwsh
117- env :
118- SCCACHE_GHA_ENABLED : " true"
119169 run : |
120170 $ErrorActionPreference = "Stop"
121171 bash -lc 'ci/scripts/build_iceberg.sh $(pwd) OFF ON'
122172 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
123173 sccache --show-stats
174+ - name : Save sccache cache
175+ if : github.ref == 'refs/heads/main'
176+ uses : actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
177+ with :
178+ path : ${{ github.workspace }}/.sccache
179+ key : sccache-test-windows-${{ github.run_id }}
124180 - name : Build Example
125181 shell : pwsh
126182 run : |
@@ -131,6 +187,9 @@ jobs:
131187 name : Meson - ${{ matrix.title }}
132188 runs-on : ${{ matrix.runs-on }}
133189 timeout-minutes : 30
190+ env :
191+ SCCACHE_DIR : ${{ github.workspace }}/.sccache
192+ SCCACHE_CACHE_SIZE : " 2G"
134193 strategy :
135194 max-parallel : 15
136195 fail-fast : false
@@ -159,24 +218,34 @@ jobs:
159218 python3 -m pip install --upgrade pip
160219 python3 -m pip install -r requirements.txt
161220 - name : Set Ubuntu Compilers
221+ # Wrap the compiler with sccache: Meson auto-detects sccache for the
222+ # default compiler (macOS/Windows), but uses an explicit CC/CXX verbatim,
223+ # so the launcher must be prepended here to route Ubuntu compiles through it.
162224 if : ${{ startsWith(matrix.runs-on, 'ubuntu') }}
163225 run : |
164- echo "CC=${{ matrix.CC }}" >> $GITHUB_ENV
165- echo "CXX=${{ matrix.CXX }}" >> $GITHUB_ENV
226+ echo "CC=sccache ${{ matrix.CC }}" >> $GITHUB_ENV
227+ echo "CXX=sccache ${{ matrix.CXX }}" >> $GITHUB_ENV
228+ - name : Restore sccache cache
229+ uses : actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
230+ with :
231+ path : ${{ github.workspace }}/.sccache
232+ key : sccache-meson-${{ matrix.runs-on }}-${{ github.run_id }}
233+ restore-keys : |
234+ sccache-meson-${{ matrix.runs-on }}-
166235 - name : Setup sccache
167- if : ${{ startsWith(matrix.runs-on, 'windows') }}
168236 uses : mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
169- - name : Enable sccache
170- if : ${{ startsWith(matrix.runs-on, 'windows') }}
171- shell : bash
172- run : echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
173237 - name : Build Iceberg
174238 run : |
175239 meson setup builddir ${{ matrix.meson-setup-args || '' }}
176240 meson compile -C builddir
177241 - name : Show sccache stats
178- if : ${{ startsWith(matrix.runs-on, 'windows') }}
179242 run : sccache --show-stats
243+ - name : Save sccache cache
244+ if : github.ref == 'refs/heads/main'
245+ uses : actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
246+ with :
247+ path : ${{ github.workspace }}/.sccache
248+ key : sccache-meson-${{ matrix.runs-on }}-${{ github.run_id }}
180249 - name : Test Iceberg
181250 run : |
182251 meson test -C builddir --timeout-multiplier 0 --print-errorlogs
0 commit comments