forked from bambulab/BambuStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
321 lines (271 loc) · 10.6 KB
/
Copy pathcd-packages.yml
File metadata and controls
321 lines (271 loc) · 10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# SPDX-FileCopyrightText: 2026 BenJule <benjamin.luetker@gmail.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
name: 'CD: Build Packages'
run-name: "Build packages — ${{ github.actor }}"
on:
workflow_dispatch:
inputs:
retention-days:
description: 'Artifact retention days'
type: number
default: 14
skip-debian:
description: 'Skip Debian trixie .deb build'
type: boolean
default: false
skip-fedora:
description: 'Skip Fedora 42 .rpm build'
type: boolean
default: false
skip-arch:
description: 'Skip Arch Linux .pkg.tar.zst build'
type: boolean
default: false
workflow_call:
inputs:
retention-days:
description: 'Artifact retention days'
type: number
default: 14
skip-debian:
description: 'Skip Debian trixie .deb build'
type: boolean
default: false
skip-fedora:
description: 'Skip Fedora 42 .rpm build'
type: boolean
default: false
skip-arch:
description: 'Skip Arch Linux .pkg.tar.zst build'
type: boolean
default: false
permissions: read-all
concurrency:
group: ${{ github.workflow }}-packages-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# ── Debian trixie .deb ───────────────────────────────────────────────────
build_debian:
name: Linux / Debian trixie .deb
if: ${{ !inputs.skip-debian }}
runs-on: ubuntu-24.04
timeout-minutes: 180
container:
image: ghcr.io/benjule/bambu-debian-trixie:trixie
credentials:
username: ${{ github.actor }}
password: ${{ github.token }}
permissions: read-all
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Bootstrap
run: apt-get update -qq && apt-get install -y --no-install-recommends sudo git curl git-lfs ca-certificates
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
lfs: 'true'
fetch-depth: 0
- name: Cache deps
id: cache-deps
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: deps/build/destdir
key: pkg-deps-debian-trixie-${{ hashFiles('deps/CMakeLists.txt', 'deps/**/*.cmake') }}
- name: Install build dependencies
run: sudo ./BuildLinux.sh -ur
- name: Fix permissions
run: chown -R "$(id -u):$(id -g)" ./
- name: Build deps
if: steps.cache-deps.outputs.cache-hit != 'true'
run: ./BuildLinux.sh -dfr
- name: Build BambuStudio
id: build-bambu
run: |
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
./BuildLinux.sh -sfr
cd build && ./src/BuildLinuxImage.sh
- name: Smoke test
if: steps.build-bambu.outcome == 'success'
run: |
BINARY=./build/src/bambu-studio
# 1. Shared library check — catch missing .so before packaging
MISSING=$(ldd "$BINARY" 2>/dev/null | grep "not found" || true)
if [[ -n "$MISSING" ]]; then
echo "::error::Missing shared libraries in built binary:"
echo "$MISSING"
exit 1
fi
echo "OK: all shared libraries resolved"
# 2. Resources check — catch missing profiles/images
for dir in ./resources/profiles ./resources/images; do
if [[ ! -d "$dir" ]]; then
echo "::error::Expected resource directory missing: $dir"
exit 1
fi
done
PROFILES=$(find ./resources/profiles -name "*.json" 2>/dev/null | wc -l)
echo "OK: $PROFILES printer profile files found"
# 3. Headless startup check
apt-get install -y --no-install-recommends xvfb
Xvfb :99 -screen 0 1280x800x24 &
sleep 2
EXIT=0
DISPLAY=:99 LIBGL_ALWAYS_SOFTWARE=1 \
timeout 20 "$BINARY" > /tmp/smoke.log 2>&1 || EXIT=$?
kill %1 2>/dev/null || true
if [ "$EXIT" -ne 0 ] && [ "$EXIT" -ne 124 ]; then
echo "::error::bambustudio crashed on startup (exit $EXIT)"
cat /tmp/smoke.log
exit 1
fi
if grep -q "gtk_window_resize: assertion" /tmp/smoke.log; then
echo "::error::GTK regression detected: gtk_window_resize assertion 'width > 0' failed"
grep "Gtk-CRITICAL" /tmp/smoke.log | head -10
exit 1
fi
GTK_WARNS=$(grep -c "Gtk-CRITICAL" /tmp/smoke.log || true)
echo "### Smoke test" >> "$GITHUB_STEP_SUMMARY"
echo "✅ Started headless (Xvfb), ran 20s without crash" >> "$GITHUB_STEP_SUMMARY"
if [ "$GTK_WARNS" -gt 0 ]; then
echo "⚠️ $GTK_WARNS other Gtk-CRITICAL warning(s) — review log" >> "$GITHUB_STEP_SUMMARY"
else
echo "✅ No GTK-CRITICAL warnings" >> "$GITHUB_STEP_SUMMARY"
fi
- name: Build package
run: ./BuildLinux.sh -pr
- name: Get version
id: ver
uses: ./.github/actions/get-version
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: BambuStudio_debian-trixie_deb_${{ steps.ver.outputs.ver }}
path: ./build/bambustudio_*.deb
if-no-files-found: error
retention-days: ${{ inputs.retention-days || 14 }}
# ── Fedora 42 .rpm ────────────────────────────────────────────────────────
build_fedora:
name: Linux / Fedora 42 .rpm
if: ${{ !inputs.skip-fedora }}
runs-on: ubuntu-24.04
timeout-minutes: 180
continue-on-error: true
# Pull from our GHCR mirror (built by ci-fedora-container.yml) instead of
# Docker Hub directly — avoids the anonymous Docker Hub pull-rate limit, same
# as Debian and Arch.
container:
image: ghcr.io/benjule/bambu-fedora:42
credentials:
username: ${{ github.actor }}
password: ${{ github.token }}
permissions: read-all
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Bootstrap
run: dnf install -y sudo git curl git-lfs
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
lfs: 'true'
fetch-depth: 0
- name: Cache deps
id: cache-deps
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: deps/build/destdir
key: pkg-deps-fedora42_rpm-${{ hashFiles('deps/CMakeLists.txt', 'deps/**/*.cmake') }}
- name: Install build dependencies
run: sudo ./BuildLinux.sh -ur
- name: Fix permissions
run: chown -R "$(id -u):$(id -g)" ./
- name: Build deps
if: steps.cache-deps.outputs.cache-hit != 'true'
run: ./BuildLinux.sh -dfr
- name: Build BambuStudio
id: build-bambu
run: |
./BuildLinux.sh -sfr
cd build && ./src/BuildLinuxImage.sh
- name: Build package
run: bash scripts/build_rpm.sh
- name: Get version
id: ver
uses: ./.github/actions/get-version
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: BambuStudio_fedora42_rpm_${{ steps.ver.outputs.ver }}
path: ./build/bambustudio-*.rpm
if-no-files-found: warn
retention-days: ${{ inputs.retention-days || 14 }}
# ── Arch Linux .pkg.tar.zst ───────────────────────────────────────────────
build_arch:
name: Linux / Arch Linux .pkg.tar.zst
if: ${{ !inputs.skip-arch }}
runs-on: ubuntu-24.04
timeout-minutes: 180
continue-on-error: true
# Pull from our GHCR mirror (built by ci-arch-container.yml) instead of
# Docker Hub directly — avoids the anonymous Docker Hub pull-rate limit that
# intermittently failed this job at "Initialize containers".
container:
image: ghcr.io/benjule/bambu-archlinux:base
credentials:
username: ${{ github.actor }}
password: ${{ github.token }}
permissions: read-all
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Bootstrap
run: pacman -Syu --noconfirm sudo git curl git-lfs unzip
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
lfs: 'true'
fetch-depth: 0
- name: Cache deps
id: cache-deps
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: deps/build/destdir
key: pkg-deps-arch-${{ hashFiles('deps/CMakeLists.txt', 'deps/**/*.cmake') }}
- name: Install cmake 3.31.x (Arch)
uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4
with:
cmakeVersion: "~3.31.0"
useLocalCache: true
useCloudCache: true
- name: Install build dependencies
run: sudo ./BuildLinux.sh -ur
- name: Fix permissions
run: chown -R "$(id -u):$(id -g)" ./
- name: Build deps
if: steps.cache-deps.outputs.cache-hit != 'true'
run: ./BuildLinux.sh -dfr
- name: Build BambuStudio
id: build-bambu
run: |
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
./BuildLinux.sh -sfr
cd build && ./src/BuildLinuxImage.sh
- name: Build package
run: bash scripts/build_pkg_arch.sh
- name: Get version
id: ver
uses: ./.github/actions/get-version
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: BambuStudio_arch_pkg_${{ steps.ver.outputs.ver }}
path: ./build/bambustudio-*.pkg.tar.zst
if-no-files-found: warn
retention-days: ${{ inputs.retention-days || 14 }}