Skip to content

Commit fba8784

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

File tree

1 file changed

+40
-10
lines changed

1 file changed

+40
-10
lines changed

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

Lines changed: 40 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,64 @@ 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
54+
mkdir -p "$GITHUB_WORKSPACE/.bin"
55+
ln -s "$SCCACHE_PATH" "$GITHUB_WORKSPACE/.bin/gcc"
56+
ln -s "$SCCACHE_PATH" "$GITHUB_WORKSPACE/.bin/g++"
57+
echo "CC=$GITHUB_WORKSPACE/.bin/gcc" | tee -a $GITHUB_ENV
58+
echo "CXX=$GITHUB_WORKSPACE/.bin/g++" | tee -a $GITHUB_ENV
59+
echo "CMAKE_GENERATOR=Ninja" | tee -a $GITHUB_ENV
4460
4561
- name: Install Windows dependencies
4662
if: startsWith( matrix.os, 'windows' )
47-
run: choco install -y zip ninja
63+
shell: powershell
64+
run: |
65+
choco install -y zip ninja
66+
67+
$sccacheDir = (Get-Item -Path "${env:SCCACHE_PATH}.exe").Directory.FullName
68+
New-Item -Path "$env:GITHUB_WORKSPACE/.bin/" -ItemType Directory -Force
69+
New-Item -ItemType SymbolicLink -Path "$env:GITHUB_WORKSPACE/.bin/cl.exe" -Target "$sccacheDir/sccache.exe"
70+
echo "$env:GITHUB_WORKSPACE/.bin" >> $env:GITHUB_PATH
71+
echo "CMAKE_C_COMPILER=$env:GITHUB_WORKSPACE/.bin/cl.exe" >> $env:GITHUB_ENV
72+
echo "CMAKE_CXX_COMPILER=$env:GITHUB_WORKSPACE/.bin/cl.exe" >> $env:GITHUB_ENV
73+
echo "VCPKG_ENV_PASSTHROUGH=1" >> $env:GITHUB_ENV
74+
echo "CMAKE_GENERATOR=Ninja" >> $env:GITHUB_ENV
4875
4976
- name: Install macOS dependencies
5077
if: startsWith( matrix.os, 'macos' )
51-
run: brew install zip ninja
78+
shell: bash
79+
run: |
80+
brew install zip ninja
5281
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 || '');
82+
mkdir -p "$GITHUB_WORKSPACE/.bin"
83+
ln -s "$SCCACHE_PATH" "$GITHUB_WORKSPACE/.bin/clang"
84+
ln -s "$SCCACHE_PATH" "$GITHUB_WORKSPACE/.bin/clang++"
85+
echo "CC=$GITHUB_WORKSPACE/.bin/clang" | tee -a $GITHUB_ENV
86+
echo "CXX=$GITHUB_WORKSPACE/.bin/clang++" | tee -a $GITHUB_ENV
87+
echo "CMAKE_GENERATOR=Ninja" | tee -a $GITHUB_ENV
5988
6089
- name: Build
6190
id: build
6291
env:
63-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
6492
MSYSTEM: ""
93+
SCCACHE_GHA_ENABLED: true
94+
VCPKG_BUILD_TYPE: Release
6595
run: make build
6696

6797
- name: Report build failure

0 commit comments

Comments
 (0)