Skip to content

Commit 1998f62

Browse files
committed
Try using sccache
1 parent 6f89c82 commit 1998f62

File tree

2 files changed

+46
-70
lines changed

2 files changed

+46
-70
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@ on:
1010
pull_request:
1111

1212
env:
13-
BUILDCACHE_VERSION: v0.27.3
14-
BUILDCACHE_ACCURACY: STRICT
15-
BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB
13+
SCCACHE_GHA_ENABLED: "true"
14+
RUSTC_WRAPPER: "sccache"
1615

1716
jobs:
1817
build-linux:
1918
name: Build Linux (${{matrix.name}} x86_64)
2019
runs-on: ubuntu-latest
2120

22-
#env:
23-
#BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
24-
2521
strategy:
2622
fail-fast: false
2723
matrix:
@@ -39,49 +35,43 @@ jobs:
3935

4036
- name: Install dependencies
4137
run: |
42-
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
43-
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
44-
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
45-
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
46-
sudo apt-get -y install ninja-build clang lld openssl libcurl4-openssl-dev intel-oneapi-ipp-devel \
38+
sudo apt-get -y install ninja-build clang lld openssl libcurl4-openssl-dev \
4739
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
4840
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev libfreetype-dev \
4941
libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev libssl-dev \
5042
libxss-dev libfuse2
5143
52-
# setup buildcache
53-
#curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE"
54-
#echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
55-
5644
# free up disk space
57-
# https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173
45+
# https://github.com/actions/runner-images/issues/2840#issuecomment-3583950111
5846
echo Before
5947
df -h .
6048
sudo apt-get clean
61-
sudo rm -rf /usr/share/dotnet
62-
sudo rm -rf /opt/ghc
63-
sudo rm -rf /usr/local/share/boost
64-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
49+
sudo rm -rf \
50+
"$AGENT_TOOLSDIRECTORY" \
51+
/opt/ghc \
52+
/opt/google/chrome \
53+
/opt/microsoft/msedge \
54+
/opt/microsoft/powershell \
55+
/opt/pipx \
56+
/usr/lib/mono \
57+
/usr/local/julia* \
58+
/usr/local/lib/android \
59+
/usr/local/share/chromium \
60+
/usr/local/share/powershell \
61+
/usr/share/dotnet \
62+
/usr/share/swift
6563
echo After
6664
df -h .
6765
68-
#- name: Restore buildcache
69-
# uses: pat-s/always-upload-cache@v3
70-
# with:
71-
# path: ${{env.BUILDCACHE_DIR}}
72-
# key: buildcache-${{runner.os}}-${{matrix.preset}}-${{github.sha}}
73-
# restore-keys: |
74-
# buildcache-${{runner.os}}-${{matrix.preset}}-
66+
- name: Setup sccache
67+
uses: mozilla-actions/sccache-action@v0.0.9
7568

7669
- name: Configure CMake
7770
run: cmake --preset x-linux-ci-${{matrix.preset}}
7871

7972
- name: Build
8073
run: cmake --build --preset x-linux-ci-${{matrix.preset}}
8174

82-
#- name: Print buildcache stats
83-
# run: buildcache -s
84-
8575
- name: Generate AppImage
8676
run: ci/build-appimage.sh
8777

@@ -114,38 +104,14 @@ jobs:
114104
brew install cmake ninja graphicsmagick imagemagick
115105
pip3 install --break-system-packages markupsafe
116106
117-
# setup buildcache
118-
curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
119-
unzip /tmp/buildcache-macos.zip -d "$RUNNER_WORKSPACE"
120-
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
121-
122-
- name: Install Intel IPP
123-
if: 'false' # not supported for universal build
124-
run: |
125-
NAME="m_ipp_oneapi_p_${IPP_VERSION}_offline"
126-
curl -LSfs https://registrationcenter-download.intel.com/akdlm/irc_nas/17606/$NAME.dmg -o /tmp/$NAME.dmg
127-
sudo hdiutil attach /tmp/$NAME.dmg -quiet
128-
sudo /Volumes/$NAME/bootstrapper.app/Contents/MacOS/install.sh -c --action install --eula accept
129-
sudo hdiutil detach /Volumes/$NAME -quiet
130-
rm /tmp/$NAME.dmg
131-
132-
- name: Restore buildcache
133-
uses: pat-s/always-upload-cache@v3
134-
with:
135-
path: ${{env.BUILDCACHE_DIR}}
136-
key: buildcache-${{runner.os}}-universal-${{github.sha}}
137-
restore-keys: |
138-
buildcache-${{runner.os}}-universal-
107+
- name: Setup sccache
108+
uses: mozilla-actions/sccache-action@v0.0.9
139109

140110
- name: Configure CMake
141111
run: cmake --preset x-macos-ci
142112

143113
- name: Build
144114
run: cmake --build --preset x-macos-ci
145-
146-
- name: Print buildcache stats
147-
if: 'false' # temporarily disabled
148-
run: buildcache -s
149115

150116
#- name: Import signing certificate
151117
# if: 'false' # temporarily disabled
@@ -183,6 +149,9 @@ jobs:
183149
brew install cmake ninja
184150
pip3 install --break-system-packages markupsafe
185151
152+
- name: Setup sccache
153+
uses: mozilla-actions/sccache-action@v0.0.9
154+
186155
- name: Install Rust iOS target
187156
run: rustup target add aarch64-apple-ios
188157

@@ -220,6 +189,9 @@ jobs:
220189
brew install cmake ninja
221190
pip3 install --break-system-packages markupsafe
222191
192+
- name: Setup sccache
193+
uses: mozilla-actions/sccache-action@v0.0.9
194+
223195
- name: Install Rust nightly + tvOS target
224196
run: |
225197
rustup toolchain install nightly
@@ -247,7 +219,6 @@ jobs:
247219
runs-on: windows-latest
248220

249221
env:
250-
IPP_VERSION: 2021.2.0.210
251222
BUILD_DIR: C:\build
252223

253224
strategy:
@@ -265,19 +236,12 @@ jobs:
265236
fetch-depth: 0
266237
submodules: recursive
267238

268-
- name: Install Intel IPP
269-
if: 'false' # takes >10min, not worth it
270-
run: |
271-
$TempDir = "$env:RUNNER_WORKSPACE\temp"
272-
$Filename = "w_ipp_oneapi_p_${env:IPP_VERSION}_offline.exe"
273-
New-Item -Path "$TempDir" -ItemType Directory -ea 0
274-
(New-Object Net.WebClient).DownloadFile("https://registrationcenter-download.intel.com/akdlm/irc_nas/17739/$Filename", "$TempDir\$Filename")
275-
Start-Process "$TempDir\$Filename" -ArgumentList "--x --s --f $TempDir\ipp" -Wait
276-
Start-Process "$TempDir\ipp\bootstrapper.exe" -ArgumentList "--eula accept -c --action install" -Wait
277-
278239
- name: Install dependencies
279240
run: choco install ninja
280241

242+
- name: Setup sccache
243+
uses: mozilla-actions/sccache-action@v0.0.9
244+
281245
- name: Enable Visual Studio environment
282246
uses: ilammy/msvc-dev-cmd@v1
283247

CMakePresets.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,11 @@
366366
"hidden": true,
367367
"inherits": [
368368
"relwithdebinfo"
369-
]
369+
],
370+
"cacheVariables": {
371+
"CMAKE_C_COMPILER_LAUNCHER": "sccache",
372+
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
373+
}
370374
},
371375
{
372376
"name": "x-linux-ci-gcc",
@@ -386,15 +390,23 @@
386390
"name": "x-macos-ci",
387391
"inherits": [
388392
"macos-default-relwithdebinfo"
389-
]
393+
],
394+
"cacheVariables": {
395+
"CMAKE_C_COMPILER_LAUNCHER": "sccache",
396+
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
397+
}
390398
},
391399
{
392400
"name": "x-windows-ci",
393401
"hidden": true,
394402
"inherits": [
395403
"relwithdebinfo"
396404
],
397-
"binaryDir": "$env{BUILD_DIR}"
405+
"binaryDir": "$env{BUILD_DIR}",
406+
"cacheVariables": {
407+
"CMAKE_C_COMPILER_LAUNCHER": "sccache",
408+
"CMAKE_CXX_COMPILER_LAUNCHER": "sccache"
409+
}
398410
},
399411
{
400412
"name": "x-windows-ci-msvc",

0 commit comments

Comments
 (0)