From 207211faccc81096956b8cc4d444b93b0d349c4e Mon Sep 17 00:00:00 2001 From: tooomm Date: Sun, 18 May 2025 04:25:01 +0200 Subject: [PATCH] CI: Tweak ccache for Linux builds (#5938) * rework ccache * use branch name --- .github/workflows/desktop-build.yml | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 59e4d5005..f5d3f86eb 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -135,25 +135,20 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Generate cache timestamp - id: cache_timestamp - shell: bash - run: echo "timestamp=$(date -u '+%Y%m%d%H%M%S')" >>"$GITHUB_OUTPUT" - - - name: Restore cache - uses: actions/cache@v4 - env: - timestamp: ${{steps.cache_timestamp.outputs.timestamp}} - with: - path: ${{env.CACHE}} - key: docker-${{matrix.distro}}${{matrix.version}}-cache-${{env.timestamp}} - restore-keys: | - docker-${{matrix.distro}}${{matrix.version}}-cache- - - name: Build ${{matrix.distro}} ${{matrix.version}} Docker image shell: bash run: source .ci/docker.sh --build + - name: Restore compiler cache (ccache) + id: ccache_restore + uses: actions/cache/restore@v4 + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + with: + path: ${{env.CACHE}} + key: ccache-${{matrix.distro}}${{matrix.version}}-${{env.BRANCH_NAME}} + restore-keys: ccache-${{matrix.distro}}${{matrix.version}}- + - name: Build debug and test if: matrix.test != 'skip' shell: bash @@ -178,6 +173,13 @@ jobs: --ccache "$CCACHE_SIZE" .ci/name_build.sh + - name: Save compiler cache (ccache) + if: github.ref == 'refs/heads/master' + uses: actions/cache/save@v4 + with: + path: ${{env.CACHE}} + key: ${{ steps.ccache_restore.outputs.cache-primary-key }} + - name: Upload artifact if: matrix.package != 'skip' uses: actions/upload-artifact@v4