Skip to content

Commit df39e95

Browse files
committed
Replace vcpkg cache with sccache
1 parent 31e3ba8 commit df39e95

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

.github/workflows/build-multi-platform.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323

2424
steps:
2525
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
submodules: recursive
2629

2730
- uses: jurplel/install-qt-action@v4
2831
with:
@@ -31,37 +34,56 @@ jobs:
3134

3235
- uses: actions/setup-go@v5
3336
with:
34-
go-version: '^1.24.0'
37+
go-version: "^1.24.0"
38+
39+
- uses: ilammy/msvc-dev-cmd@v1
40+
if: startsWith( matrix.os, 'windows' )
41+
42+
- uses: mozilla-actions/sccache-action@main
3543

3644
- name: Install Linux dependencies
3745
if: startsWith( matrix.os, 'ubuntu' )
46+
shell: bash
3847
run: |
3948
sudo apt-get install -y \
4049
ninja-build \
4150
libglvnd-dev \
4251
libsecret-1-dev \
52+
linux-libc-dev \
4353
pkg-config
4454
55+
echo "CC=${SCCACHE_PATH} gcc" >> $GITHUB_ENV
56+
echo "CXX=${SCCACHE_PATH} g++" >> $GITHUB_ENV
57+
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
58+
echo "VCPKG_KEEP_ENV_VARS=CC;CXX;CMAKE_GENERATOR" >> $GITHUB_ENV
59+
4560
- name: Install Windows dependencies
4661
if: startsWith( matrix.os, 'windows' )
47-
run: choco install -y zip ninja
62+
shell: powershell
63+
run: |
64+
choco install -y zip ninja
65+
66+
$sccacheDir = (Get-Item -Path "${env:SCCACHE_PATH}.exe").Directory.FullName
67+
New-Item -Path "$env:GITHUB_WORKSPACE/.bin/" -ItemType Directory -Force
68+
New-Item -ItemType SymbolicLink -Path "$env:GITHUB_WORKSPACE/.bin/cl.exe" -Target "$sccacheDir/sccache.exe"
69+
echo "$env:GITHUB_WORKSPACE/.bin" >> $env:GITHUB_PATH
4870
4971
- name: Install macOS dependencies
5072
if: startsWith( matrix.os, 'macos' )
51-
run: brew install zip ninja
73+
shell: bash
74+
run: |
75+
brew install zip ninja
5276
53-
- name: Export GitHub Actions cache environment variables
54-
uses: actions/github-script@v7
55-
with:
56-
script: |
57-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
58-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
77+
echo "CC=${SCCACHE_PATH} clang" >> $GITHUB_ENV
78+
echo "CXX=${SCCACHE_PATH} clang++" >> $GITHUB_ENV
79+
echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
80+
echo "VCPKG_KEEP_ENV_VARS=CC;CXX;CMAKE_GENERATOR" >> $GITHUB_ENV
5981
6082
- name: Build
6183
id: build
6284
env:
63-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
6485
MSYSTEM: ""
86+
SCCACHE_GHA_ENABLED: true
6587
run: make build
6688

6789
- name: Report build failure

0 commit comments

Comments
 (0)