From cbeeb9e00db69f0a5260a7fa8e4269b6aa1698c6 Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 24 Oct 2024 22:05:01 -0500 Subject: [PATCH] ci: adjust caching strategy use hashFiles('depends/packages/*') for depends stuff don't mix stuff between hosts try to use PR base if we don't have direct match for ccache --- .github/workflows/build.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3f5651892..755034196a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -105,15 +105,12 @@ jobs: uses: actions/cache@v4 with: path: | - depends/built depends/${{ matrix.host }} - depends/sdk-sources # We don't care about no specific key as depends system will handle that for us - key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} + key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ hashFiles('depends/packages/*') }} restore-keys: | - ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} + ${{ runner.os }}-depends-${{ matrix.host }}-${{ hashFiles('depends/packages/*') }} ${{ runner.os }}-depends-${{ matrix.host }} - ${{ runner.os }}-depends - name: Build dependencies run: make -j$(nproc) -C depends HOST=${{ matrix.host }} @@ -156,15 +153,16 @@ jobs: uses: actions/cache/restore@v4 with: path: | - depends/built depends/${{ matrix.host }} - depends/sdk-sources - # We don't care about no specific key as depends system will handle that for us - key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} + key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ hashFiles('depends/packages/*') }} restore-keys: | - ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} + ${{ runner.os }}-depends-${{ matrix.host }}-${{ hashFiles('depends/packages/*') }} ${{ runner.os }}-depends-${{ matrix.host }} - ${{ runner.os }}-depends + + - name: Determine PR Base SHA + id: vars + run: | + echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT - name: CCache uses: actions/cache@v4 @@ -174,8 +172,8 @@ jobs: key: ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} + ${{ runner.os }}-${{ matrix.host }}-${{ steps.vars.outputs.PR_BASE_SHA }} ${{ runner.os }}-${{ matrix.host }} - ${{ runner.os }} - name: Build source and run tests run: |