diff --git a/.github/workflows/gh-actions.yml b/.github/workflows/gh-actions.yml index 55b259da..8b463989 100644 --- a/.github/workflows/gh-actions.yml +++ b/.github/workflows/gh-actions.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ "master" ] +env: + SCCACHE_GHA_ENABLED: "true" + jobs: build: name: ${{ matrix.config.name }} — ${{ matrix.build_type }} @@ -28,6 +31,10 @@ jobs: - uses: actions/checkout@v4 with: submodules: true + fetch-depth: 1 + + - name: Setup sccache + uses: mozilla-actions/sccache-action@v0.0.9 - name: Setup latest Xcode if: matrix.config.name == 'Apple-Clang' @@ -42,13 +49,25 @@ jobs: which git git --version - - name: Install LLVM/Clang 21 + - name: Cache LLVM 21 + id: cache-llvm if: matrix.config.name == 'Clang' + uses: actions/cache@v4 + with: + path: /usr/lib/llvm-21 + key: llvm-21-${{ runner.os }}-${{ hashFiles('.github/workflows/gh-actions.yml') }} + + - name: Install LLVM/Clang 21 + if: matrix.config.name == 'Clang' && steps.cache-llvm.outputs.cache-hit != 'true' # https://apt.llvm.org run: | wget https://apt.llvm.org/llvm.sh chmod u+x llvm.sh sudo ./llvm.sh 21 all + + - name: Set LLVM/Clang 21 env vars + if: matrix.config.name == 'Clang' + run: | echo "PATH=/usr/lib/llvm-21/bin:$PATH" >> $GITHUB_ENV echo "LLVM_PATH=/usr/lib/llvm-21" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=/usr/lib/llvm-21/lib" >> $GITHUB_ENV @@ -60,10 +79,7 @@ jobs: if: matrix.config.name == 'GCC' run: | apt-get update - apt-get install -y ninja-build - cmake_ver=3.31.4 - wget -qO- "https://github.com/Kitware/CMake/releases/download/v${cmake_ver}/cmake-${cmake_ver}-linux-x86_64.tar.gz" | tar xz --strip-components=1 -C /usr/local - cmake --version + apt-get install -y ninja-build cmake - name: Set reusable strings id: strings @@ -79,6 +95,8 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_C_COMPILER_LAUNCHER=sccache + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DGitHubCIRun=true -S ${{ steps.strings.outputs.source-dir }}