Skip to content

Commit

Permalink
github: Try to use ccache for the builds of LLVM
Browse files Browse the repository at this point in the history
This should allow speeding up successive rebuilds of the same
build configuration, as long as the base LLVM version that is
being built is the same.

The second stage builds are run with

    CCACHE_COMPILERCHECK="%compiler% -v"

as the mtime of the compiler can change in successive rebuilds
of the first stage, even if the output binaries are identical.
(Although we could fix the timestamps when tarring the output.)

On the level of building LLVM, there is no significant measurable
difference in build speed between using
CCACHE_COMPILERCHECK="%compiler% -v" and CCACHE_COMPILERCHECK="none".
  • Loading branch information
mstorsjo committed Apr 30, 2024
1 parent 88bad0d commit 515c1e7
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 1500M
key: linux-native
verbose: 1
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
Expand All @@ -83,7 +89,7 @@ jobs:
# Skip dynamic library dependencies that might make it harder to
# run the binaries on other distros (and that have little use within
# llvm-mingw).
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLDB_ENABLE_PYTHON=OFF" COMPILER_LAUNCHER="ccache" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
RUN_I686=false RUN_X86_64=false ./run-tests.sh $(pwd)/install/llvm-mingw
cd install
Expand All @@ -106,14 +112,20 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 500M
key: linux-cross-aarch64
verbose: 1
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
run: |
sudo apt-get update && sudo apt-get install ninja-build g++-aarch64-linux-gnu
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --no-runtimes --host=aarch64-linux-gnu
COMPILER_LAUNCHER="ccache" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --no-runtimes --host=aarch64-linux-gnu
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
- uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -190,6 +202,12 @@ jobs:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 750M
key: macos
verbose: 1
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
Expand All @@ -204,7 +222,7 @@ jobs:
# form. Therefore, autodetection will pick them up, but linking
# universal binaries fails as those libraries are unavailable in the
# other (arm64) architecture form.
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF -DLLDB_ENABLE_PYTHON=OFF" COMPILER_LAUNCHER="ccache" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
RUN_I686=false RUN_X86_64=false ./run-tests.sh $(pwd)/install/llvm-mingw
cd install
Expand Down Expand Up @@ -248,7 +266,14 @@ jobs:
toolchain:p
cmake:p
ninja:p
ccache:p
- uses: actions/checkout@v4
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 600M
key: msys2-${{matrix.sys}}
verbose: 1
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
Expand All @@ -260,7 +285,7 @@ jobs:
if [ "${{matrix.sys}}" = "mingw64" ]; then
ARGS="--disable-dylib"
fi
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb $ARGS
COMPILER_LAUNCHER="ccache" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb $ARGS
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
./copy-msys-dependencies.sh $(pwd)/install/llvm-mingw ${{matrix.sys}}
./run-tests.sh $(pwd)/install/llvm-mingw
Expand Down Expand Up @@ -301,6 +326,12 @@ jobs:
sudo mv llvm-mingw* /opt/llvm-mingw
echo /opt/llvm-mingw/bin >> $GITHUB_PATH
- uses: actions/checkout@v4
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 800M
key: linux-cross-windows-${{matrix.arch}}
verbose: 1
- name: Build
env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
Expand All @@ -311,7 +342,7 @@ jobs:
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: |
sudo apt-get update && sudo apt-get install autoconf-archive ninja-build
./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw ${{matrix.arch}} --with-python
COMPILER_LAUNCHER="ccache" CCACHE_COMPILERCHECK="%compiler% -v" ./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw ${{matrix.arch}} --with-python
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install
NAME=llvm-mingw-$TAG-${{matrix.crt}}-${{matrix.arch}}
Expand Down

0 comments on commit 515c1e7

Please sign in to comment.