Skip to content

Commit d955a5a

Browse files
committed
ci: cache native build outputs and merge per-platform artifacts
The native binaries are a pure function of the src/main/native sources, yet every workflow invocation recompiled all of them from scratch: each PR push triggered three parallel full rebuilds (pre-merge + test-graalvm + test-packaging), and a release tag four more. build-natives.yaml now caches each platform's output tree keyed on hashFiles('**/src/main/native/**') plus the workflow itself; on a hit every toolchain/compile step is skipped and the job only verifies and re-publishes. Per-module verify/upload steps are collapsed into one verify step and one merged artifact per platform (natives-windows, natives-macos, natives-linux-{x64,aarch64}), so the ~25 copy-pasted download steps in each of the 7 consumer jobs become a single 'pattern: natives-*' download. pre-merge.yaml also gains a concurrency group cancelling superseded PR runs (pushes to main are never cancelled: their run saves the shared caches).
1 parent 813670a commit d955a5a

9 files changed

Lines changed: 253 additions & 2053 deletions

.github/workflows/build-natives.yaml

Lines changed: 222 additions & 796 deletions
Large diffs are not rendered by default.

.github/workflows/pre-merge.yaml

Lines changed: 14 additions & 211 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ on:
1010
# trigger too — the single-star glob does not cross path separators.
1111
- '**'
1212

13+
# Supersede in-flight runs on PR pushes; pushes to main are never cancelled
14+
# (their run saves the caches every other workflow keys off).
15+
concurrency:
16+
group: pre-merge-${{ github.head_ref || github.ref }}
17+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
18+
1319
jobs:
1420
build-natives:
1521
uses: ./.github/workflows/build-natives.yaml
@@ -24,179 +30,10 @@ jobs:
2430
- name: Checkout Repo
2531
uses: actions/checkout@v4
2632

27-
- name: Download darkmode-detector native artifacts
28-
uses: actions/download-artifact@v4
29-
with:
30-
path: darkmode-detector/src/main/resources/nucleus/native/
31-
pattern: '*-natives*'
32-
merge-multiple: true
33-
34-
- name: Download native-ssl artifacts
35-
uses: actions/download-artifact@v4
36-
with:
37-
path: native-ssl/src/main/resources/nucleus/native/
38-
pattern: 'ssl-*'
39-
merge-multiple: true
40-
41-
- name: Download decorated-window-jbr artifacts
42-
uses: actions/download-artifact@v4
43-
with:
44-
path: decorated-window-jbr/src/main/resources/nucleus/native/
45-
pattern: 'decorated-window-jbr-*'
46-
merge-multiple: true
47-
48-
- name: Download decorated-window-jni artifacts
49-
uses: actions/download-artifact@v4
50-
with:
51-
path: decorated-window-jni/src/main/resources/nucleus/native/
52-
pattern: 'decorated-window-jni-*'
53-
merge-multiple: true
54-
55-
- name: Download decorated-window-core artifacts
56-
uses: actions/download-artifact@v4
57-
with:
58-
path: decorated-window-core/src/main/resources/nucleus/native/
59-
pattern: 'decorated-window-core-*'
60-
merge-multiple: true
61-
62-
- name: Download linux-hidpi artifacts
63-
uses: actions/download-artifact@v4
64-
with:
65-
path: linux-hidpi/src/main/resources/nucleus/native/
66-
pattern: 'linux-hidpi-*'
67-
merge-multiple: true
68-
69-
- name: Download system-color artifacts
70-
uses: actions/download-artifact@v4
71-
with:
72-
path: system-color/src/main/resources/nucleus/native/
73-
pattern: 'system-color-*'
74-
merge-multiple: true
75-
76-
- name: Download energy-manager artifacts
77-
uses: actions/download-artifact@v4
78-
with:
79-
path: energy-manager/src/main/resources/nucleus/native/
80-
pattern: 'energy-manager-*'
81-
merge-multiple: true
82-
83-
- name: Download taskbar-progress artifacts
84-
uses: actions/download-artifact@v4
85-
with:
86-
path: taskbar-progress/src/main/resources/nucleus/native/
87-
pattern: 'taskbar-progress-*'
88-
merge-multiple: true
89-
90-
- name: Download fs-watcher artifacts
91-
uses: actions/download-artifact@v4
92-
with:
93-
path: fs-watcher/src/main/resources/nucleus/native/
94-
pattern: 'fs-watcher-*'
95-
merge-multiple: true
96-
97-
- name: Download notification-macos artifacts
98-
uses: actions/download-artifact@v4
99-
with:
100-
path: notification-macos/src/main/resources/nucleus/native/
101-
pattern: 'notification-macos*'
102-
merge-multiple: true
103-
104-
- name: Download service-management-macos artifacts
105-
uses: actions/download-artifact@v4
106-
with:
107-
path: service-management-macos/src/main/resources/nucleus/native/
108-
pattern: 'service-management-macos*'
109-
merge-multiple: true
110-
111-
- name: Download notification-linux artifacts
112-
uses: actions/download-artifact@v4
113-
with:
114-
path: notification-linux/src/main/resources/nucleus/native/
115-
pattern: 'notification-linux-*'
116-
merge-multiple: true
117-
118-
- name: Download notification-windows artifacts
119-
uses: actions/download-artifact@v4
120-
with:
121-
path: notification-windows/src/main/resources/nucleus/native/
122-
pattern: 'notification-windows*'
123-
merge-multiple: true
124-
125-
- name: Download autolaunch artifacts
33+
- name: Download native artifacts
12634
uses: actions/download-artifact@v4
12735
with:
128-
path: autolaunch/src/main/resources/nucleus/native/
129-
pattern: 'autolaunch*'
130-
merge-multiple: true
131-
132-
- name: Download launcher-windows artifacts
133-
uses: actions/download-artifact@v4
134-
with:
135-
path: launcher-windows/src/main/resources/nucleus/native/
136-
pattern: 'launcher-windows*'
137-
merge-multiple: true
138-
139-
- name: Download launcher-linux artifacts
140-
uses: actions/download-artifact@v4
141-
with:
142-
path: launcher-linux/src/main/resources/nucleus/native/
143-
pattern: 'launcher-linux-*'
144-
merge-multiple: true
145-
146-
- name: Download launcher-macos artifacts
147-
uses: actions/download-artifact@v4
148-
with:
149-
path: launcher-macos/src/main/resources/nucleus/native/
150-
pattern: 'launcher-macos*'
151-
merge-multiple: true
152-
153-
- name: Download global-hotkey artifacts
154-
uses: actions/download-artifact@v4
155-
with:
156-
path: global-hotkey/src/main/resources/nucleus/native/
157-
pattern: 'global-hotkey-*'
158-
merge-multiple: true
159-
160-
- name: Download menu-macos artifacts
161-
uses: actions/download-artifact@v4
162-
with:
163-
path: menu-macos/src/main/resources/nucleus/native/
164-
pattern: 'menu-macos*'
165-
merge-multiple: true
166-
167-
- name: Download system-info artifacts
168-
uses: actions/download-artifact@v4
169-
with:
170-
path: system-info/src/main/resources/nucleus/native/
171-
pattern: 'system-info-*'
172-
merge-multiple: true
173-
174-
- name: Download scheduler artifacts
175-
uses: actions/download-artifact@v4
176-
with:
177-
path: scheduler/src/main/resources/nucleus/native/
178-
pattern: 'scheduler-*'
179-
merge-multiple: true
180-
181-
- name: Download media-control artifacts
182-
uses: actions/download-artifact@v4
183-
with:
184-
path: media-control/src/main/resources/nucleus/native/
185-
pattern: 'media-control-*'
186-
merge-multiple: true
187-
188-
- name: Download decorated-window-tao artifacts
189-
uses: actions/download-artifact@v4
190-
with:
191-
path: decorated-window-tao/src/main/resources/nucleus/native/
192-
pattern: 'decorated-window-tao-*'
193-
merge-multiple: true
194-
195-
- name: Download graalvm-runtime artifacts
196-
uses: actions/download-artifact@v4
197-
with:
198-
path: graalvm-runtime/src/main/resources/nucleus/native/
199-
pattern: 'graalvm-runtime-*'
36+
pattern: 'natives-*'
20037
merge-multiple: true
20138

20239
- name: Verify all natives present
@@ -371,11 +208,10 @@ jobs:
371208
- name: Checkout Repo
372209
uses: actions/checkout@v4
373210

374-
- name: Download decorated-window-tao artifacts
211+
- name: Download native artifacts
375212
uses: actions/download-artifact@v4
376213
with:
377-
path: decorated-window-tao/src/main/resources/nucleus/native/
378-
pattern: 'decorated-window-tao-*'
214+
pattern: 'natives-*'
379215
merge-multiple: true
380216

381217
- name: Set up JDK 21
@@ -405,11 +241,10 @@ jobs:
405241
- name: Checkout Repo
406242
uses: actions/checkout@v4
407243

408-
- name: Download decorated-window-tao artifacts
244+
- name: Download native artifacts
409245
uses: actions/download-artifact@v4
410246
with:
411-
path: decorated-window-tao/src/main/resources/nucleus/native/
412-
pattern: 'decorated-window-tao-*'
247+
pattern: 'natives-*'
413248
merge-multiple: true
414249

415250
- name: Set up JDK 21
@@ -481,42 +316,10 @@ jobs:
481316
- name: Checkout Repo
482317
uses: actions/checkout@v4
483318

484-
- name: Download decorated-window-tao artifacts
485-
uses: actions/download-artifact@v4
486-
with:
487-
path: decorated-window-tao/src/main/resources/nucleus/native/
488-
pattern: 'decorated-window-tao-*'
489-
merge-multiple: true
490-
491-
# tao-demo's build graph pulls these modules' native-build tasks in too;
492-
# providing the prebuilt artifacts keeps CI from compiling them (the
493-
# runner lacks the X11 dev headers decorated-window-jni needs).
494-
- name: Download decorated-window-jni artifacts
495-
uses: actions/download-artifact@v4
496-
with:
497-
path: decorated-window-jni/src/main/resources/nucleus/native/
498-
pattern: 'decorated-window-jni-*'
499-
merge-multiple: true
500-
501-
- name: Download decorated-window-core artifacts
502-
uses: actions/download-artifact@v4
503-
with:
504-
path: decorated-window-core/src/main/resources/nucleus/native/
505-
pattern: 'decorated-window-core-*'
506-
merge-multiple: true
507-
508-
- name: Download linux-hidpi artifacts
509-
uses: actions/download-artifact@v4
510-
with:
511-
path: linux-hidpi/src/main/resources/nucleus/native/
512-
pattern: 'linux-hidpi-*'
513-
merge-multiple: true
514-
515-
- name: Download graalvm-runtime artifacts
319+
- name: Download native artifacts
516320
uses: actions/download-artifact@v4
517321
with:
518-
path: graalvm-runtime/src/main/resources/nucleus/native/
519-
pattern: 'graalvm-runtime-*'
322+
pattern: 'natives-*'
520323
merge-multiple: true
521324

522325
- name: Set up JDK 21

0 commit comments

Comments
 (0)