Skip to content

Commit e8f5bb8

Browse files
committed
GHA: setup sccache for early builds
Although these builds are small, the overall time cost is annoying when doing repeated builds. Attempt to use sccache to amortise some of the cost.
1 parent 700f2ba commit e8f5bb8

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/swift-toolchain.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,23 @@ jobs:
176176
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
177177
arch: ${{ matrix.arch }}
178178

179+
- name: Setup sccache
180+
uses: hendrikmuhs/ccache-action@v1
181+
with:
182+
max-size: 100M
183+
key: sccache-windows-${{ matrix.arch }}-sqlite
184+
variant: sccache
185+
179186
- name: Configure SQLite
180187
run: |
181188
cmake -B ${{ github.workspace }}/BinaryCache/sqlite-3.43.2 `
182189
-D BUILD_SHARED_LIBS=NO `
183190
-D CMAKE_BUILD_TYPE=Release `
184191
-D CMAKE_C_COMPILER=cl `
192+
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
185193
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
186194
-D CMAKE_CXX_COMPILER=cl `
195+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
187196
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
188197
-D CMAKE_MT=mt `
189198
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/sqlite-3.43.2/usr `
@@ -227,15 +236,24 @@ jobs:
227236
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
228237
arch: amd64
229238

239+
- name: Setup sccache
240+
uses: hendrikmuhs/ccache-action@v1
241+
with:
242+
max-size: 100M
243+
key: sccache-windows-amd64-icu_tools
244+
variant: sccache
245+
230246
- name: Configure ICU Build Tools
231247
run:
232248
cmake -B ${{ github.workspace }}/BinaryCache/icu-tools-69.1 `
233249
-D BUILD_SHARED_LIBS=NO `
234250
-D BUILD_TOOLS=YES `
235251
-D CMAKE_BUILD_TYPE=Release `
236252
-D CMAKE_C_COMPILER=cl `
253+
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
237254
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
238255
-D CMAKE_CXX_COMPILER=cl `
256+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
239257
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
240258
-D CMAKE_MT=mt `
241259
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/icu-69.1/usr `
@@ -303,15 +321,24 @@ jobs:
303321
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
304322
arch: ${{ matrix.arch }}
305323

324+
- name: Setup sccache
325+
uses: hendrikmuhs/ccache-action@v1
326+
with:
327+
max-size: 100M
328+
key: sccache-windows-${{ matrix.arch }}-icu
329+
variant: sccache
330+
306331
- name: Configure ICU
307332
run: |
308333
cmake -B ${{ github.workspace }}/BinaryCache/icu-69.1 `
309334
-D BUILD_SHARED_LIBS=NO `
310335
-D BUILD_TOOLS=${{ matrix.BUILD_TOOLS }} `
311336
-D CMAKE_BUILD_TYPE=Release `
312337
-D CMAKE_C_COMPILER=cl `
338+
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
313339
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
314340
-D CMAKE_CXX_COMPILER=cl `
341+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
315342
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
316343
-D CMAKE_MT=mt `
317344
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/icu-69.1/usr `
@@ -367,13 +394,22 @@ jobs:
367394

368395
- uses: compnerd/gha-setup-vsdevenv@main
369396

397+
- name: Setup sccache
398+
uses: hendrikmuhs/ccache-action@v1
399+
with:
400+
max-size: 100M
401+
key: sccache-windows-amd64-build_tools
402+
variant: sccache
403+
370404
- name: Configure Tools
371405
run: |
372406
cmake -B ${{ github.workspace }}/BinaryCache/0 `
373407
-D CMAKE_BUILD_TYPE=Release `
374408
-D CMAKE_C_COMPILER=cl `
409+
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
375410
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
376411
-D CMAKE_CXX_COMPILER=cl `
412+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
377413
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
378414
-D CMAKE_MT=mt `
379415
-G Ninja `
@@ -534,6 +570,13 @@ jobs:
534570
COMPILE_FLAGS "/Od /Gw /Oi /Oy /Gw /Ob2 /Ot /GF")
535571
"@
536572
573+
- name: Setup sccache
574+
uses: hendrikmuhs/ccache-action@v1
575+
with:
576+
max-size: 500M
577+
key: sccache-windows-${{ matrix.arch }}-compilers
578+
variant: sccache
579+
537580
- name: Configure Compilers
538581
run: |
539582
if ( "${{ matrix.arch }}" -eq "arm64" ) {
@@ -554,8 +597,10 @@ jobs:
554597
-C ${{ github.workspace }}/SourceCache/swift/cmake/caches/${CACHE} `
555598
-D CMAKE_BUILD_TYPE=Release `
556599
-D CMAKE_C_COMPILER=cl `
600+
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
557601
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
558602
-D CMAKE_CXX_COMPILER=cl `
603+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
559604
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
560605
-D CMAKE_MT=mt `
561606
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr `
@@ -653,14 +698,23 @@ jobs:
653698
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
654699
arch: ${{ matrix.arch }}
655700

701+
- name: Setup sccache
702+
uses: hendrikmuhs/ccache-action@v1
703+
with:
704+
max-size: 100M
705+
key: sccache-windows-${{ matrix.arch }}-zlib
706+
variant: sccache
707+
656708
- name: Configure zlib
657709
run: |
658710
cmake -B ${{ github.workspace }}/BinaryCache/zlib-1.3 `
659711
-D BUILD_SHARED_LIBS=NO `
660712
-D CMAKE_BUILD_TYPE=Release `
661713
-D CMAKE_C_COMPILER=cl `
714+
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
662715
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
663716
-D CMAKE_CXX_COMPILER=cl `
717+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
664718
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
665719
-D CMAKE_MT=mt `
666720
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/zlib-1.3/usr `
@@ -705,14 +759,23 @@ jobs:
705759
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
706760
arch: ${{ matrix.arch }}
707761

762+
- name: Setup sccache
763+
uses: hendrikmuhs/ccache-action@v1
764+
with:
765+
max-size: 100M
766+
key: sccache-windows-${{ matrix.arch }}-curl
767+
variant: sccache
768+
708769
- name: Configure curl
709770
run: |
710771
cmake -B ${{ github.workspace }}/BinaryCache/curl-7.77.0 `
711772
-D BUILD_SHARED_LIBS=NO `
712773
-D CMAKE_BUILD_TYPE=Release `
713774
-D CMAKE_C_COMPILER=cl `
775+
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
714776
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
715777
-D CMAKE_CXX_COMPILER=cl `
778+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
716779
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
717780
-D CMAKE_MT=mt `
718781
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/curl-7.77.0/usr `
@@ -775,14 +838,23 @@ jobs:
775838
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
776839
arch: ${{ matrix.arch }}
777840

841+
- name: Setup sccache
842+
uses: hendrikmuhs/ccache-action@v1
843+
with:
844+
max-size: 100M
845+
key: sccache-windows-${{ matrix.arch }}-libxml2
846+
variant: sccache
847+
778848
- name: Configure libxml2
779849
run: |
780850
cmake -B ${{ github.workspace }}/BinaryCache/libxml2-2.11.5 `
781851
-D BUILD_SHARED_LIBS=NO `
782852
-D CMAKE_BUILD_TYPE=Release `
783853
-D CMAKE_C_COMPILER=cl `
854+
-D CMAKE_C_COMPILER_LAUNCHER=sccache `
784855
-D CMAKE_C_FLAGS="${{ needs.context.outputs.CMAKE_C_FLAGS }}" `
785856
-D CMAKE_CXX_COMPILER=cl `
857+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache `
786858
-D CMAKE_CXX_FLAGS="${{ needs.context.outputs.CMAKE_CXX_FLAGS }}" `
787859
-D CMAKE_MT=mt `
788860
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/libxml2-2.11.5/usr `

0 commit comments

Comments
 (0)