From f3eb750d4f0737174865a6b0544afbfcc05d53fd Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 1 Dec 2025 13:09:18 -0600 Subject: [PATCH 1/3] ci: add caching for dependency sources in CI workflow - Introduced a new job `cache-sources` in the GitHub Actions workflow to cache dependency sources, improving build efficiency. - Updated existing jobs to depend on `cache-sources` to utilize cached data when available. - Created a new file `cache-depends-sources.yml` to define the caching logic, including steps for checking and downloading sources. This change enhances the CI process by reducing redundant downloads and speeding up builds. --- .github/workflows/build.yml | 18 ++++++---- .github/workflows/cache-depends-sources.yml | 37 +++++++++++++++++++++ 2 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/cache-depends-sources.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bae21f41933..6450bf915faa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,12 @@ jobs: echo "skip=false" >> $GITHUB_OUTPUT fi + cache-sources: + name: Cache depends sources + needs: [check-skip] + if: ${{ needs.check-skip.outputs.skip == 'false' }} + uses: ./.github/workflows/cache-depends-sources.yml + container: name: Build container needs: [check-skip] @@ -60,7 +66,7 @@ jobs: depends-arm-linux: name: arm-linux-gnueabihf uses: ./.github/workflows/build-depends.yml - needs: [container] + needs: [container, cache-sources] if: ${{ vars.SKIP_ARM_LINUX == '' }} with: build-target: arm-linux @@ -69,7 +75,7 @@ jobs: depends-linux64: name: x86_64-pc-linux-gnu uses: ./.github/workflows/build-depends.yml - needs: [container] + needs: [container, cache-sources] if: | vars.SKIP_LINUX64 == '' || vars.SKIP_LINUX64_FUZZ == '' || @@ -82,7 +88,7 @@ jobs: depends-linux64_multiprocess: name: x86_64-pc-linux-gnu_multiprocess uses: ./.github/workflows/build-depends.yml - needs: [container] + needs: [container, cache-sources] if: | vars.SKIP_LINUX64_MULTIPROCESS == '' || vars.SKIP_LINUX64_TSAN == '' @@ -93,7 +99,7 @@ jobs: depends-linux64_nowallet: name: x86_64-pc-linux-gnu_nowallet uses: ./.github/workflows/build-depends.yml - needs: [container] + needs: [container, cache-sources] if: ${{ vars.SKIP_LINUX64_NOWALLET == '' }} with: build-target: linux64_nowallet @@ -102,7 +108,7 @@ jobs: depends-mac: name: x86_64-apple-darwin uses: ./.github/workflows/build-depends.yml - needs: [container] + needs: [container, cache-sources] if: ${{ vars.SKIP_MAC == '' }} with: build-target: mac @@ -111,7 +117,7 @@ jobs: depends-win64: name: x86_64-w64-mingw32 uses: ./.github/workflows/build-depends.yml - needs: [container] + needs: [container, cache-sources] if: ${{ vars.SKIP_WIN64 == '' }} with: build-target: win64 diff --git a/.github/workflows/cache-depends-sources.yml b/.github/workflows/cache-depends-sources.yml new file mode 100644 index 000000000000..3e5dbabbbaa9 --- /dev/null +++ b/.github/workflows/cache-depends-sources.yml @@ -0,0 +1,37 @@ +name: Cache depends sources + +on: + workflow_call: + schedule: + # Run daily at 6 AM UTC on the default branch to keep cache warm + - cron: '0 6 * * *' + +jobs: + cache-sources: + name: Cache depends sources + runs-on: ubuntu-24.04-arm + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + + - name: Check for cached sources + id: cache-check + uses: actions/cache@v4 + with: + path: depends/sources + key: depends-sources-${{ hashFiles('depends/packages/*') }} + restore-keys: depends-sources- + lookup-only: true + + - name: Download sources + if: steps.cache-check.outputs.cache-hit != 'true' + run: make -C depends download + + - name: Save sources cache + if: steps.cache-check.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: depends/sources + key: depends-sources-${{ hashFiles('depends/packages/*') }} From 8b4b623746b50f83d3436a6f43a07f9eadc46a8e Mon Sep 17 00:00:00 2001 From: pasta Date: Tue, 2 Dec 2025 08:49:46 -0600 Subject: [PATCH 2/3] fix: use actions/cache/restore in build-depends.yml --- .github/workflows/build-depends.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-depends.yml b/.github/workflows/build-depends.yml index b2fefcba010c..a30aa8a0ee23 100644 --- a/.github/workflows/build-depends.yml +++ b/.github/workflows/build-depends.yml @@ -45,7 +45,7 @@ jobs: shell: bash - name: Cache depends sources - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: | depends/sources From 72eb33d747156e962c689ff751b9820b98143134 Mon Sep 17 00:00:00 2001 From: pasta Date: Tue, 2 Dec 2025 08:56:07 -0600 Subject: [PATCH 3/3] fix: use RAII style cache save --- .github/workflows/build-depends.yml | 2 +- .github/workflows/cache-depends-sources.yml | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/build-depends.yml b/.github/workflows/build-depends.yml index a30aa8a0ee23..fae81b06b113 100644 --- a/.github/workflows/build-depends.yml +++ b/.github/workflows/build-depends.yml @@ -44,7 +44,7 @@ jobs: shell: bash - - name: Cache depends sources + - name: Restore depends sources uses: actions/cache/restore@v4 with: path: | diff --git a/.github/workflows/cache-depends-sources.yml b/.github/workflows/cache-depends-sources.yml index 3e5dbabbbaa9..4178e7bd5352 100644 --- a/.github/workflows/cache-depends-sources.yml +++ b/.github/workflows/cache-depends-sources.yml @@ -28,10 +28,3 @@ jobs: - name: Download sources if: steps.cache-check.outputs.cache-hit != 'true' run: make -C depends download - - - name: Save sources cache - if: steps.cache-check.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: depends/sources - key: depends-sources-${{ hashFiles('depends/packages/*') }}