From 354d6a9aab6868832fb999a68d7b63f3aab34b32 Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 24 Oct 2024 18:54:41 -0500 Subject: [PATCH 1/4] ci: cache depends sources in a seperate step --- .github/workflows/build.yml | 10 ++++++++++ .github/workflows/guix-build.yml | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 106ec66e156bd..d3f5651892ac7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -91,6 +91,16 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} + - name: Cache depends sources + uses: actions/cache@v4 + with: + path: | + depends/sources + # We don't care about no specific key as depends system will handle that for us + key: depends-sources-${{ hashFiles('depends/packages/*') }} + restore-keys: | + depends-sources- + - name: Cache dependencies uses: actions/cache@v4 with: diff --git a/.github/workflows/guix-build.yml b/.github/workflows/guix-build.yml index 1f7722abef302..cc37826496b0e 100644 --- a/.github/workflows/guix-build.yml +++ b/.github/workflows/guix-build.yml @@ -79,6 +79,14 @@ jobs: path: dash fetch-depth: 0 + - name: Cache depends sources + uses: actions/cache@v4 + with: + path: dash/depends/sources + key: depends-sources-${{ hashFiles('dash/depends/packages/*') }} + restore-keys: | + depends-sources- + - name: Cache Guix and depends id: guix-cache-restore uses: actions/cache@v3 @@ -86,7 +94,6 @@ jobs: path: | ${{ github.workspace }}/.cache ${{ github.workspace }}/dash/depends/built - ${{ github.workspace }}/dash/depends/sources ${{ github.workspace }}/dash/depends/work /gnu/store key: ${{ runner.os }}-guix-${{ matrix.build_target }}-${{ github.sha }} From cbeeb9e00db69f0a5260a7fa8e4269b6aa1698c6 Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 24 Oct 2024 22:05:01 -0500 Subject: [PATCH 2/4] 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 d3f5651892ac7..755034196a13d 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: | From 189233b987fce35ab221faadb0ce34aa47273d96 Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 24 Oct 2024 22:47:19 -0500 Subject: [PATCH 3/4] ci: handle ccache / depends based on build_target not host to avoid failing to cache all the linux 86_64 runs --- .github/workflows/build.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 755034196a13d..8e63d92eb388a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,10 +107,10 @@ jobs: path: | depends/${{ matrix.host }} # We don't care about no specific key as depends system will handle that for us - key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ hashFiles('depends/packages/*') }} + key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} restore-keys: | - ${{ runner.os }}-depends-${{ matrix.host }}-${{ hashFiles('depends/packages/*') }} - ${{ runner.os }}-depends-${{ matrix.host }} + ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} + ${{ runner.os }}-depends-${{ matrix.build_target }} - name: Build dependencies run: make -j$(nproc) -C depends HOST=${{ matrix.host }} @@ -154,10 +154,10 @@ jobs: with: path: | depends/${{ matrix.host }} - key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ hashFiles('depends/packages/*') }} + key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} restore-keys: | - ${{ runner.os }}-depends-${{ matrix.host }}-${{ hashFiles('depends/packages/*') }} - ${{ runner.os }}-depends-${{ matrix.host }} + ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} + ${{ runner.os }}-depends-${{ matrix.build_target }} - name: Determine PR Base SHA id: vars @@ -169,11 +169,11 @@ jobs: with: path: | /cache - key: ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} + key: ${{ runner.os }}-${{ matrix.build_target }}-${{ 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 }}-${{ matrix.build_target }}-${{ github.sha }} + ${{ runner.os }}-${{ matrix.build_target }}-${{ steps.vars.outputs.PR_BASE_SHA }} + ${{ runner.os }}-${{ matrix.build_target }} - name: Build source and run tests run: | From a856b81f0ee0899a5dee112b6974c6a65453a92b Mon Sep 17 00:00:00 2001 From: pasta Date: Fri, 25 Oct 2024 09:46:53 -0500 Subject: [PATCH 4/4] ci: drop unneeded comments --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e63d92eb388a..e1ac9c50b191c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,7 +96,6 @@ jobs: with: path: | depends/sources - # We don't care about no specific key as depends system will handle that for us key: depends-sources-${{ hashFiles('depends/packages/*') }} restore-keys: | depends-sources- @@ -106,7 +105,6 @@ jobs: with: path: | depends/${{ matrix.host }} - # We don't care about no specific key as depends system will handle that for us key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} restore-keys: | ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}