Skip to content

Commit 6d0bb9f

Browse files
committed
Add build artifact caching to CI workflow
Implement two-layer caching strategy to significantly reduce CI runtime: 1. External downloads cache (Image, rootfs.cpio): - Caches prebuilt Linux kernel (~72MB) and initrd - Key: external-${{ hashFiles('mk/external.mk') }} - Invalidates only when SHA1 checksums change - Shared across all OS platforms 2. Submodule builds cache (libgdbstub.a, libslirp.a): - Caches compiled third-party libraries - Key: ${{ runner.os }}-submodules-${{ hashFiles(...) }} - Per-platform caching for binary compatibility - Invalidates when submodule commits change
1 parent 9944dd9 commit 6d0bb9f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ jobs:
1717
steps:
1818
- name: checkout code
1919
uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
- name: cache external downloads
23+
uses: actions/cache@v4
24+
with:
25+
path: |
26+
Image
27+
rootfs.cpio
28+
key: external-${{ hashFiles('mk/external.mk') }}
29+
restore-keys: |
30+
external-
31+
- name: cache submodule builds
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
mini-gdbstub/build
36+
minislirp/src/*.a
37+
key: ${{ runner.os }}-submodules-${{ hashFiles('.gitmodules', 'mini-gdbstub/**', 'minislirp/**') }}
38+
restore-keys: |
39+
${{ runner.os }}-submodules-
2040
- name: install-dependencies
2141
run: |
2242
sudo apt-get update
@@ -40,6 +60,26 @@ jobs:
4060
runs-on: macos-latest
4161
steps:
4262
- uses: actions/checkout@v4
63+
with:
64+
submodules: recursive
65+
- name: cache external downloads
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
Image
70+
rootfs.cpio
71+
key: external-${{ hashFiles('mk/external.mk') }}
72+
restore-keys: |
73+
external-
74+
- name: cache submodule builds
75+
uses: actions/cache@v4
76+
with:
77+
path: |
78+
mini-gdbstub/build
79+
minislirp/src/*.a
80+
key: ${{ runner.os }}-submodules-${{ hashFiles('.gitmodules', 'mini-gdbstub/**', 'minislirp/**') }}
81+
restore-keys: |
82+
${{ runner.os }}-submodules-
4383
- name: install-dependencies
4484
run: |
4585
brew install make dtc expect e2fsprogs

0 commit comments

Comments
 (0)