Skip to content

Commit c07b153

Browse files
fix workflow :D its better now
1 parent 11175cf commit c07b153

File tree

1 file changed

+32
-42
lines changed

1 file changed

+32
-42
lines changed

โ€Ž.github/workflows/build.ymlโ€Ž

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,15 @@ permissions:
1414
# CACHING ARCHITECTURE
1515
# โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1616
#
17-
# Layer 1 โ”‚ APT packages โ”‚ apt-kernel-build-v1
18-
# โ”‚ โ”‚ Saves ~30s of apt-get install per run
19-
#
20-
# Layer 2 โ”‚ ccache โ”‚ ccache-<os>-<ver>-<cfg>-<patches>-<run_id>
21-
# โ”‚ โ”‚ KEY BUG FIX: always save a NEW key per run
22-
# โ”‚ โ”‚ so restore-keys always finds the freshest
23-
# โ”‚ โ”‚ partial cache, never a stale pinned key.
17+
# Layer 1 โ”‚ ccache โ”‚ ccache-<os>-<ver>-<cfg>-<patches>-<run_id>
18+
# โ”‚ โ”‚ Always saves a NEW key per run so restore-keys
19+
# โ”‚ โ”‚ always finds the freshest partial cache.
2420
# โ”‚ โ”‚ SLOPPINESS + DIRECT mode = max hit rate.
2521
#
26-
# Layer 3 โ”‚ Source tarball โ”‚ kernel-tarball-<version>
22+
# Layer 2 โ”‚ Source tarball โ”‚ kernel-tarball-<version>
2723
# โ”‚ โ”‚ Immutable. Downloaded once, cached forever.
2824
#
29-
# Layer 4 โ”‚ Full build tree โ”‚ kernel-tree-<ver>-<cfg>-<patches>
25+
# Layer 3 โ”‚ Full build tree โ”‚ kernel-tree-<ver>-<cfg>-<patches>
3026
# โ”‚ โ”‚ Exact match = zero rebuild (incremental make).
3127
# โ”‚ โ”‚ Partial match via restore-keys still helps.
3228
# โ”‚ โ”‚ Saved unconditionally after every build.
@@ -81,7 +77,6 @@ jobs:
8177
f.write(f"{k}={v}\n")
8278
EOF
8379
84-
8580
build-kernel:
8681
needs: validate-config
8782
runs-on: ubuntu-latest
@@ -100,24 +95,24 @@ jobs:
10095
# KBUILD_BUILD_TIMESTAMP is set dynamically from git history below
10196

10297
# โ”€โ”€ ccache โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
103-
CCACHE_DIR: ${{ github.workspace }}/.ccache
104-
CCACHE_MAXSIZE: 8G
98+
CCACHE_DIR: ${{ github.workspace }}/.ccache
99+
CCACHE_MAXSIZE: 8G
105100
# Compression: on, level 6 (good balance of speed vs size)
106-
CCACHE_COMPRESS: 1
101+
CCACHE_COMPRESS: 1
107102
CCACHE_COMPRESSLEVEL: 6
108103
# Direct mode: skip preprocessing step, cache by hash of source + headers
109-
CCACHE_DIRECT: 1
104+
CCACHE_DIRECT: 1
110105
# Basedir strips the workspace prefix from paths in the cache, so the
111106
# cache is portable across different runner checkout paths
112-
CCACHE_BASEDIR: ${{ github.workspace }}
113-
CCACHE_NOHASHDIR: 1
107+
CCACHE_BASEDIR: ${{ github.workspace }}
108+
CCACHE_NOHASHDIR: 1
114109
# Sloppiness: critical for kernel builds
115110
# time_macros โ€” ignore __DATE__ / __TIME__ (we fix the timestamp anyway)
116111
# include_file_mtime โ€” don't invalidate on header mtime, only content
117112
# include_file_ctime โ€” same for ctime
118113
# file_stat_matches โ€” use stat() instead of content hash for unchanged files
119114
# pch_defines โ€” handle precompiled-header define changes gracefully
120-
CCACHE_SLOPPINESS: time_macros,include_file_mtime,include_file_ctime,file_stat_matches,pch_defines
115+
CCACHE_SLOPPINESS: time_macros,include_file_mtime,include_file_ctime,file_stat_matches,pch_defines
121116

122117
steps:
123118

@@ -134,29 +129,22 @@ jobs:
134129
echo "KBUILD_BUILD_TIMESTAMP=$(date -u -d "@$SOURCE_DATE_EPOCH" '+%a %b %e %H:%M:%S UTC %Y')" >> "$GITHUB_ENV"
135130
echo "KBUILD_BUILD_VERSION=${GITHUB_RUN_NUMBER}" >> "$GITHUB_ENV"
136131
137-
# โ”€โ”€ Layer 1: APT cache โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
138-
- name: Restore APT cache
139-
id: apt-cache
140-
uses: actions/cache@v4
141-
with:
142-
path: |
143-
/var/cache/apt/archives/*.deb
144-
/var/lib/apt/lists
145-
key: apt-kernel-build-v1
146-
restore-keys: apt-kernel-build-
147-
132+
# โ”€โ”€ Dependencies โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
133+
# APT caching is intentionally omitted: GitHub runners refresh their
134+
# package index on every boot, making cached .deb archives unreliable.
135+
# The install is fast enough (~20โ€“30 s) that the complexity isn't worth it.
148136
- name: Install build dependencies
149137
run: |
150138
sudo apt-get update -qq
151139
sudo apt-get install -y --no-install-recommends \
152140
build-essential bc bison flex \
153141
libssl-dev libelf-dev libncurses-dev \
154-
dwarves rsync cpio wget \
155-
ccache zstd ca-certificates
142+
dwarves rsync cpio \
143+
ccache zstd
156144
# Put ccache shims first so 'gcc' resolves to ccache transparently
157145
echo "/usr/lib/ccache" >> "$GITHUB_PATH"
158146
159-
# โ”€โ”€ Layer 2: ccache (restore) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
147+
# โ”€โ”€ Layer 1: ccache (restore) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
160148
# Use cache/restore (not cache) so we can save a fresh key after build.
161149
# Primary key includes run_id so we ALWAYS write a new entry, and
162150
# restore-keys fan out from most- to least-specific for the best warmup.
@@ -175,7 +163,7 @@ jobs:
175163
- name: Zero ccache stats (for clean per-run reporting)
176164
run: ccache --zero-stats
177165

178-
# โ”€โ”€ Layer 3: Source tarball โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
166+
# โ”€โ”€ Layer 2: Source tarball โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
179167
- name: Restore kernel source tarball
180168
id: kernel-tarball
181169
uses: actions/cache@v4
@@ -186,12 +174,12 @@ jobs:
186174
- name: Download kernel tarball
187175
if: steps.kernel-tarball.outputs.cache-hit != 'true'
188176
run: |
189-
wget -q --show-progress \
190-
"https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/linux-${FULL_VERSION}.tar.xz" \
191-
"https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/sha256sums.asc"
192-
grep "linux-${FULL_VERSION}.tar.xz" sha256sums.asc | sha256sum -c -
177+
curl -fsSL --output "linux-${FULL_VERSION}.tar.xz" \
178+
"https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/linux-${FULL_VERSION}.tar.xz"
179+
curl -fsSL "https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/sha256sums.asc" \
180+
| grep "linux-${FULL_VERSION}.tar.xz" | sha256sum -c -
193181
194-
# โ”€โ”€ Layer 4: Build tree (restore) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
182+
# โ”€โ”€ Layer 3: Build tree (restore) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
195183
# Exact hit = incremental make (only changed files recompile).
196184
# Partial hit = more ccache warmup, still much faster than cold.
197185
- name: Restore build tree
@@ -231,11 +219,13 @@ jobs:
231219
shopt -s nullglob
232220
for patch in ../patches/*.patch; do
233221
echo " โ†’ applying $(basename "$patch")"
234-
patch -p1 --fuzz=5 < "$patch"
222+
patch -p1 < "$patch"
235223
done
236224
237225
# โ”€โ”€ Build โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
238-
# -pipe: use pipes instead of temp files between compiler passes
226+
# -pipe: use pipes instead of temp files between compiler passes
227+
# bzImage only: modules are not packaged so skip the modules target to
228+
# avoid spending ~30โ€“60 % of build time on unused output.
239229
# LOCALVERSION: must match what was passed to olddefconfig above
240230
- name: Build kernel
241231
working-directory: kernel
@@ -244,14 +234,14 @@ jobs:
244234
CC="ccache gcc" \
245235
LOCALVERSION="-Hyperion-${HYPERION_VER}" \
246236
KCFLAGS="-pipe" \
247-
bzImage modules
237+
bzImage
248238
249239
# โ”€โ”€ ccache report โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
250240
- name: ccache statistics
251241
if: always()
252242
run: ccache --show-stats --verbose
253243

254-
# โ”€โ”€ Layer 4: Build tree (save) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
244+
# โ”€โ”€ Layer 3: Build tree (save) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
255245
# Always save so the next run gets the freshest incremental state.
256246
# If key already exists GitHub skips the upload silently.
257247
- name: Save build tree
@@ -261,7 +251,7 @@ jobs:
261251
path: kernel
262252
key: kernel-tree-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-${{ env.PATCHES_HASH }}
263253

264-
# โ”€โ”€ Layer 2: ccache (save) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
254+
# โ”€โ”€ Layer 1: ccache (save) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
265255
# Save even on build failure so a partial run still warms future runs.
266256
- name: Save ccache
267257
if: always()

0 commit comments

Comments
ย (0)