diff --git a/.github/workflows/build-depends.yml b/.github/workflows/build-depends.yml index b2fefcba010c..fae81b06b113 100644 --- a/.github/workflows/build-depends.yml +++ b/.github/workflows/build-depends.yml @@ -44,8 +44,8 @@ jobs: shell: bash - - name: Cache depends sources - uses: actions/cache@v4 + - name: Restore depends sources + uses: actions/cache/restore@v4 with: path: | depends/sources 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..4178e7bd5352 --- /dev/null +++ b/.github/workflows/cache-depends-sources.yml @@ -0,0 +1,30 @@ +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