Skip to content

Commit b12e32d

Browse files
Merge dashpay#7027: ci: add caching for dependency sources in CI workflow
72eb33d fix: use RAII style cache save (pasta) 8b4b623 fix: use actions/cache/restore in build-depends.yml (pasta) f3eb750 ci: add caching for dependency sources in CI workflow (pasta) Pull request description: ## Issue being fixed or feature implemented - 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 is more important because in DashCoreAutoGuix, because things are less often merged into develop (they are merged into their own feature branch) the shared caches coming from develop become stale and get evicted. If we run it daily, it will ensure the shared cache (in develop) can be used by the runs in the feature branches. It may also be useful here, because currently each run tries to generate it's own cache, and they may race, and the sources used by the different runs are slightly different. This is normally masked, because the final depends are cached well in this repo. This change enhances the CI process by reducing redundant downloads and speeding up builds. ## What was done? ## How Has This Been Tested? ## Breaking Changes ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 72eb33d kwvg: utACK 72eb33d Tree-SHA512: 1f246340f86bd083515dd0ee2e8f6f515adc0f011d7d02c7b3507e4eb3e34314a997c827e13277b5ec76e01e37d8f1633b57a98b6a93b3d6a1d8e53d6b3b5f0a
2 parents 4bbdc7f + 72eb33d commit b12e32d

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

.github/workflows/build-depends.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
4545
shell: bash
4646

47-
- name: Cache depends sources
48-
uses: actions/cache@v4
47+
- name: Restore depends sources
48+
uses: actions/cache/restore@v4
4949
with:
5050
path: |
5151
depends/sources

.github/workflows/build.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ jobs:
3737
echo "skip=false" >> $GITHUB_OUTPUT
3838
fi
3939
40+
cache-sources:
41+
name: Cache depends sources
42+
needs: [check-skip]
43+
if: ${{ needs.check-skip.outputs.skip == 'false' }}
44+
uses: ./.github/workflows/cache-depends-sources.yml
45+
4046
container:
4147
name: Build container
4248
needs: [check-skip]
@@ -60,7 +66,7 @@ jobs:
6066
depends-arm-linux:
6167
name: arm-linux-gnueabihf
6268
uses: ./.github/workflows/build-depends.yml
63-
needs: [container]
69+
needs: [container, cache-sources]
6470
if: ${{ vars.SKIP_ARM_LINUX == '' }}
6571
with:
6672
build-target: arm-linux
@@ -69,7 +75,7 @@ jobs:
6975
depends-linux64:
7076
name: x86_64-pc-linux-gnu
7177
uses: ./.github/workflows/build-depends.yml
72-
needs: [container]
78+
needs: [container, cache-sources]
7379
if: |
7480
vars.SKIP_LINUX64 == '' ||
7581
vars.SKIP_LINUX64_FUZZ == '' ||
@@ -82,7 +88,7 @@ jobs:
8288
depends-linux64_multiprocess:
8389
name: x86_64-pc-linux-gnu_multiprocess
8490
uses: ./.github/workflows/build-depends.yml
85-
needs: [container]
91+
needs: [container, cache-sources]
8692
if: |
8793
vars.SKIP_LINUX64_MULTIPROCESS == '' ||
8894
vars.SKIP_LINUX64_TSAN == ''
@@ -93,7 +99,7 @@ jobs:
9399
depends-linux64_nowallet:
94100
name: x86_64-pc-linux-gnu_nowallet
95101
uses: ./.github/workflows/build-depends.yml
96-
needs: [container]
102+
needs: [container, cache-sources]
97103
if: ${{ vars.SKIP_LINUX64_NOWALLET == '' }}
98104
with:
99105
build-target: linux64_nowallet
@@ -102,7 +108,7 @@ jobs:
102108
depends-mac:
103109
name: x86_64-apple-darwin
104110
uses: ./.github/workflows/build-depends.yml
105-
needs: [container]
111+
needs: [container, cache-sources]
106112
if: ${{ vars.SKIP_MAC == '' }}
107113
with:
108114
build-target: mac
@@ -111,7 +117,7 @@ jobs:
111117
depends-win64:
112118
name: x86_64-w64-mingw32
113119
uses: ./.github/workflows/build-depends.yml
114-
needs: [container]
120+
needs: [container, cache-sources]
115121
if: ${{ vars.SKIP_WIN64 == '' }}
116122
with:
117123
build-target: win64
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Cache depends sources
2+
3+
on:
4+
workflow_call:
5+
schedule:
6+
# Run daily at 6 AM UTC on the default branch to keep cache warm
7+
- cron: '0 6 * * *'
8+
9+
jobs:
10+
cache-sources:
11+
name: Cache depends sources
12+
runs-on: ubuntu-24.04-arm
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
18+
19+
- name: Check for cached sources
20+
id: cache-check
21+
uses: actions/cache@v4
22+
with:
23+
path: depends/sources
24+
key: depends-sources-${{ hashFiles('depends/packages/*') }}
25+
restore-keys: depends-sources-
26+
lookup-only: true
27+
28+
- name: Download sources
29+
if: steps.cache-check.outputs.cache-hit != 'true'
30+
run: make -C depends download

0 commit comments

Comments
 (0)