diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4faff5e29..b4bc5cdd0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1045,7 +1045,7 @@ jobs: config_opts['plugin_conf']['ccache_enable'] = True config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '1G' config_opts['plugin_conf']['ccache_opts']['compress'] = True - config_opts['plugin_conf']['ccache_opts']['dir'] = "$GITHUB_WORKSPACE/.ccache" + config_opts['plugin_conf']['ccache_opts']['dir'] = "${{ github.workspace }}/.ccache" EOT # Fedora cmake build (in imhex.spec) @@ -1092,7 +1092,7 @@ jobs: steps: - name: ⬇️ Install setup dependencies run: | - sudo apt update && sudo apt install -y git curl + sudo apt update && sudo apt install -y git curl ccache - name: 🧰 Checkout uses: actions/checkout@v4 @@ -1108,9 +1108,18 @@ jobs: mkdir -p ./snap envsubst '${IMHEX_VERSION}' < ./dist/snap/snapcraft.yaml > ./snap/snapcraft.yaml + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1 + with: + key: ${{ matrix.architecture }}-snap-${{ github.run_id }} + restore-keys: ${{ matrix.architecture }}-snap + max-size: 1G + - name: 🛠️ Build uses: snapcore/action-build@v1 id: snapcraft + with: + snapcraft-args: --mounts ccache="${{ github.workspace }}/.ccache" - name: 🗝️ Generate build provenance attestations uses: actions/attest-build-provenance@v2 diff --git a/dist/snap/snapcraft.yaml b/dist/snap/snapcraft.yaml index 501af21a8..c4019789e 100644 --- a/dist/snap/snapcraft.yaml +++ b/dist/snap/snapcraft.yaml @@ -37,12 +37,16 @@ parts: build-environment: - CC: /usr/bin/gcc-14 - CXX: /usr/bin/g++-14 + - CCACHE_DIR: "$CRAFT_PROJECT_DIR/../ccache" cmake-parameters: - -DCMAKE_BUILD_TYPE=Release + - -DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache + - -DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache cmake-generator: Ninja build-packages: - cmake - ninja-build + - ccache - gcc-14 - g++-14 - git