-
Notifications
You must be signed in to change notification settings - Fork 471
Expand file tree
/
Copy pathcpp_server_build_test_release.yml
More file actions
2698 lines (2396 loc) · 104 KB
/
Copy pathcpp_server_build_test_release.yml
File metadata and controls
2698 lines (2396 loc) · 104 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: C++ Server Build, Test, and Release 🚀
on:
push:
branches: ["release-v*"]
tags:
- v*
# `labeled` is here so the ci:* escape hatches take effect without a push.
# Adding `types` replaces the defaults, so the three default activity types
# have to be listed explicitly. `unlabeled` is deliberately absent: removing
# a label only ever drops work, and including it would re-run everything.
pull_request:
types: [opened, synchronize, reopened, labeled]
merge_group:
workflow_dispatch:
inputs:
enable_signing:
description: 'Enable MSI signing with SignPath (for testing)'
required: false
default: false
type: boolean
disable_macos_signing:
description: 'Force the unsigned macOS path (reproduces a fork PR, which has no Apple secrets). Skips the self-hosted inference rigs.'
required: false
default: false
type: boolean
permissions:
contents: write
actions: read # Required for SignPath to read workflow/job details
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'pull_request' && 'pr' || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
LEMONADE_DISABLE_SYSTEMD_JOURNAL: "1"
jobs:
# ========================================================================
# BUILD JOBS - Run on rai-160-sdk workers
# ========================================================================
build-lemonade-server-installer:
name: Build Lemonade Server Installer
runs-on: windows-latest
outputs:
unsigned-artifact-id: ${{ steps.upload-unsigned-msi.outputs.artifact-id }}
steps:
- uses: actions/checkout@v5
with:
clean: true
fetch-depth: 0
- name: Install CMake if not available
uses: ./.github/actions/install-cmake-windows
- name: Install WiX Toolset
uses: ./.github/actions/install-wix
- name: Cache FetchContent dependencies
uses: actions/cache@v5
with:
path: build/_deps
# vs2026 marker: VS 2022-built _deps are generator-incompatible with the
# VS 2026 configure, so they must not be restored across the toolchain bump.
key: fetchcontent-windows-vs2026-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
fetchcontent-windows-vs2026-
- name: Run setup.ps1 to configure environment
shell: PowerShell
run: |
$ErrorActionPreference = "Stop"
.\setup.ps1
- name: Build installers
shell: PowerShell
env:
# The Tauri desktop app (cargo + webpack) is roughly a third of this
# build, and it only ends up in lemonade.msi. Every downstream test
# job installs lemonade-server-minimal.msi, so on the PR and
# merge-queue paths the full installer is pure critical-path latency;
# build-lemonade-desktop-installer covers it off the critical path.
BUILD_FULL_INSTALLER: ${{ startsWith(github.ref, 'refs/tags/v') || inputs.enable_signing == true }}
run: |
$ErrorActionPreference = "Stop"
$full = $env:BUILD_FULL_INSTALLER -eq 'true'
$target = if ($full) { "wix_installers" } else { "wix_installer_minimal" }
# wix_installers is the only target that owns two wix build runs, and
# it is only ever built here on the release and signing paths — so a
# parallel configuration used there would first run for real during a
# release. Build it serially; the two MSIs take seconds either way.
$nodes = if ($full) { "/m:1" } else { "/m:2" }
$expected = @(
"build\Release\lemond.exe",
"build\Release\LemonadeServer.exe",
"build\resources\web-app\index.html",
"lemonade-server-minimal.msi"
)
if ($full) { $expected += "build\app\lemonade-app.exe", "lemonade.msi" }
Write-Host "Building target $target..." -ForegroundColor Cyan
# Build by directory (not --preset) so we follow whichever generator
# setup.ps1 auto-detected for the installed Visual Studio version.
# /m lets MSBuild overlap independent projects — the lemonade CLI and
# LemonadeServer otherwise wait for lemonade-server-core to finish.
# Capped at 2 because /MP already spawns one cl.exe per core inside
# each project, and the two multiply: unbounded, a 4-core runner can
# reach 16 concurrent compilers and run itself out of heap.
# Passed straight through rather than via --parallel, which makes
# CMake set CL_MPCount=1 and cancel the /MP in CMakeLists.txt.
cmake --build build --config Release --target $target -- $nodes
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
# Verify outputs
$failures = @()
$expected | ForEach-Object {
if (-not (Test-Path $_)) {
Write-Host "ERROR: $_ not found!" -ForegroundColor Red
$failures += $_
}
}
if ($failures.Count -gt 0) { exit 1 }
Write-Host "Build and packaging successful!" -ForegroundColor Green
- name: Run MCP client unit test on Windows
shell: PowerShell
run: |
$ErrorActionPreference = "Stop"
# Exercise the Windows-only process, quoting, environment-block, and
# pipe/handle paths that Linux and macOS cannot cover.
cmake --build build --config Release --target test_mcp_client_config
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
ctest --test-dir build -C Release --output-on-failure -R "^mcp_client_config$"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Upload Lemonade Server Installers
id: upload-unsigned-msi
uses: actions/upload-artifact@v7
with:
name: Lemonade_Server_MSI
# Glob rather than two literal paths: lemonade.msi is only built on
# the release/signing path (see BUILD_FULL_INSTALLER above).
path: lemonade*.msi
retention-days: 7
build-lemonade-desktop-installer:
name: Build Lemonade Desktop Installer
# Packaging-only variant: it builds the Tauri desktop app and lemonade.msi,
# which no test job installs. The merge queue gates every merge, so PR
# pushes skip it and any desktop/full-MSI break still blocks at merge-queue
# time. It reports through the `Packaging builds` gate, so it takes that
# gate's `ci:distros` label rather than introducing a second label for one
# check. The release paths are excluded because the build above already
# produces lemonade.msi there; that first clause is the negation of
# BUILD_FULL_INSTALLER above, spelled the same way so the two stay
# provably complementary.
if: >-
!(startsWith(github.ref, 'refs/tags/v') || inputs.enable_signing == true) &&
(github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:distros'))
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
with:
clean: true
fetch-depth: 0
- name: Install CMake if not available
uses: ./.github/actions/install-cmake-windows
- name: Install WiX Toolset
uses: ./.github/actions/install-wix
- name: Restore FetchContent dependencies
# Restore-only, and deliberately sharing build-lemonade-server-installer's
# namespace: both jobs run bare setup.ps1, so they configure the same
# preset and produce an identical build/_deps. That job runs
# concurrently and owns the save; saving from here too would just race
# it for the same key and log a reservation failure every cold run.
# Best-effort by construction: on a run that changes CMakeLists.txt
# neither job can hit the exact key, so this one falls back through
# restore-keys or builds the dependencies cold.
uses: actions/cache/restore@v5
with:
path: build/_deps
key: fetchcontent-windows-vs2026-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
fetchcontent-windows-vs2026-
- name: Run setup.ps1 to configure environment
shell: PowerShell
run: |
$ErrorActionPreference = "Stop"
.\setup.ps1
- name: Build desktop installer
shell: PowerShell
run: |
$ErrorActionPreference = "Stop"
# /m:1, not /m:2: wix_installer_full depends on both web-app and
# tauri-app, and they both touch src/app — web-app robocopies the whole
# tree while tauri-app runs npm ci inside it. Run concurrently, robocopy
# hits files npm is rewriting and retries under its default
# /R:1000000 /W:30, hanging the job rather than failing.
cmake --build build --config Release --target wix_installer_full -- /m:1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$failures = @()
@(
"build\app\lemonade-app.exe",
"build\resources\web-app\index.html",
"lemonade.msi"
) | ForEach-Object {
if (-not (Test-Path $_)) {
Write-Host "ERROR: $_ not found!" -ForegroundColor Red
$failures += $_
}
}
if ($failures.Count -gt 0) { exit 1 }
Write-Host "Desktop installer built successfully!" -ForegroundColor Green
- name: Upload Lemonade Desktop Installer
# Without this the MSI is built and discarded, so nothing installs it
# until a tag. Note this is a new artifact name, not a restoration of
# Lemonade_Server_MSI: that one now carries only the minimal MSI off the
# release path. No in-repo consumer reads lemonade.msi from it.
uses: actions/upload-artifact@v7
with:
name: Lemonade_Desktop_MSI
path: lemonade.msi
retention-days: 7
tauri-compile-check:
name: Compile-check the Tauri host (${{ matrix.os }})
# The Tauri host is Rust, which `npm run typecheck` does not touch. Both
# jobs that build it — the Windows desktop installer and the macOS .dmg —
# defer to the merge queue, so without this a broken src-tauri compiles
# nowhere until a PR is already queued.
#
# Windows is not optional here: webview_shim.rs and lib.rs gate code behind
# cfg(target_os = "windows"), and webview2-com/windows are Windows-only
# dependencies, so a Linux-only check would miss exactly the code whose
# packaging job was deferred. cargo check rather than a full build — this
# is a compile canary, not a packaging step, so it catches type and borrow
# errors but not link failures or asset embedding: `custom-protocol` stays
# off, which is also why it needs no built renderer. Those still surface in
# the desktop installer and .dmg jobs at merge-queue time.
#
# Deliberately uncached: a cold check measures ~1.5 min, and the Actions
# cache is a 10 GB LRU pool shared with the FetchContent caches the Windows
# installer jobs restore from.
#
# Lives here rather than in Docs And Style so it can report through the
# `Packaging builds` gate, alongside the desktop installer it stands in for.
# A new job name would otherwise block nothing until someone registered it
# in branch protection.
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v5
- name: Install Tauri build dependencies
if: runner.os == 'Linux'
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev \
libayatana-appindicator3-dev librsvg2-dev patchelf
- name: Compile-check the Tauri host
working-directory: src/app/src-tauri
run: cargo check --locked --all-targets
sign-msi-installers:
name: Sign MSI Installers with SignPath
runs-on: windows-latest
needs: build-lemonade-server-installer
# Sign on tag pushes (releases) or when manually enabled via workflow_dispatch
if: startsWith(github.ref, 'refs/tags/v') || inputs.enable_signing == true
steps:
- name: Sign MSI Installers with SignPath
id: sign-msi
uses: signpath/github-action-submit-signing-request@v2
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '8103545b-7814-4edc-86d6-a91dc2a2291b'
project-slug: 'lemonade'
signing-policy-slug: 'release-signing'
github-artifact-id: '${{ needs.build-lemonade-server-installer.outputs.unsigned-artifact-id }}'
wait-for-completion: true
wait-for-completion-timeout-in-seconds: 3600
output-artifact-directory: 'signed-msi'
parameters: |
version: "${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'test' }}"
- name: Verify Signed MSI Files
shell: PowerShell
run: |
Write-Host "Verifying signed MSI files..." -ForegroundColor Cyan
if (-not (Test-Path "signed-msi\lemonade-server-minimal.msi")) {
Write-Host "ERROR: Signed lemonade-server-minimal.msi not found!" -ForegroundColor Red
exit 1
}
if (-not (Test-Path "signed-msi\lemonade.msi")) {
Write-Host "ERROR: Signed lemonade.msi not found!" -ForegroundColor Red
exit 1
}
Write-Host "Signed MSI files verified!" -ForegroundColor Green
Get-ChildItem -Path "signed-msi" -Recurse | Format-Table Name, Length
- name: Upload Signed MSI Installers
uses: actions/upload-artifact@v7
with:
name: Lemonade_Server_MSI_Signed
path: |
signed-msi/lemonade-server-minimal.msi
signed-msi/lemonade.msi
retention-days: 7
build-lemonade-deb:
name: Build Lemonade .deb Package
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
container:
image: ghcr.io/lemonade-sdk/lemonade/build-environment:ubuntu24.04
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v5
with:
clean: true
fetch-depth: 0
- name: Configure git safe directory
run: git config --global --add safe.directory $(pwd)
- name: Use the compiler cache primed into the build image
# Release builds opt out so their -fdebug-prefix-map keeps the package
# version dpkg derives from the changelog. Everywhere else it is pinned
# to the value the prime recorded, which is what makes the primed
# objects reusable across commits at all. release-v* is included
# because those pushes also produce .deb and -dbgsym artifacts.
if: ${{ !startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/heads/release-v') }}
shell: bash
run: |
set -euo pipefail
# The prime writes this file itself, so an image built without it —
# including one published before the prime existed — is detected
# rather than assumed. Compiling without a cache is the safe fallback.
debugpath_file=/opt/ccache-debugpath
if [ ! -f "$debugpath_file" ]; then
echo "No primed compiler cache in this build image; compiling without it."
exit 0
fi
{
echo "CMAKE_C_COMPILER_LAUNCHER=ccache"
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache"
echo "DEB_BUILD_DEBUGPATH=$(cat "$debugpath_file")"
} >> "$GITHUB_ENV"
ccache -z
- name: Prepare Debian build
id: get_version
uses: ./.github/actions/prepare-debian-build
with:
release: '24.04'
codename: 'noble'
- name: Build Debian package
id: build_deb
uses: ./.github/actions/build-debian-package
with:
package-type: binary
deb-version: ${{ steps.get_version.outputs.version }}
- name: Upload .deb package
uses: actions/upload-artifact@v7
with:
name: lemonade-deb
path: ${{ steps.build_deb.outputs.output-dir }}/*.deb
retention-days: 7
- name: Report compiler cache hit rate
# Set only by the opt-in step above, so this covers both the release
# path and an image published before the prime existed.
if: ${{ always() && env.CMAKE_CXX_COMPILER_LAUNCHER == 'ccache' }}
shell: bash
run: |
set -euo pipefail
ccache -s
# Zero hits against a primed image means the prime and this job
# disagree on the compile command line — most likely the workspace
# path, which GitHub derives from the repository name and the prime
# hardcodes. Warn rather than fail: a change to a widely included
# header legitimately invalidates every entry.
stats="$(ccache --print-stats 2>/dev/null || true)"
if ! grep -q '^direct_cache_hit' <<< "$stats"; then
echo "Could not read ccache counters; skipping the hit-rate check."
exit 0
fi
hits="$(awk -F'\t' '/^(direct|preprocessed)_cache_hit\t/ { n += $2 } END { print n+0 }' <<< "$stats")"
echo "Cache hits this build: ${hits}"
if [ "$hits" -eq 0 ]; then
echo "::warning title=Primed ccache produced no hits::The build image ships a primed cache but nothing matched. Check that the prime path in .ubuntu/Dockerfile still matches this job's workspace."
fi
cpp-unit-tests:
name: C++ unit tests
# Own job rather than a step of build-lemonade-deb: it shares nothing with
# the packaging build (different configure, different flags), so as a step
# it just added its full build time to the critical path that gates every
# .deb test job. Same build-environment image, so the configure resolves
# the same system dependencies.
runs-on: ubuntu-latest
container:
image: ghcr.io/lemonade-sdk/lemonade/build-environment:ubuntu24.04
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v5
- name: Configure git safe directory
run: git config --global --add safe.directory $(pwd)
- name: Install build dependencies
# As a step of build-lemonade-deb this inherited the build-dep install
# that job performs. Standalone it would rely on whatever the nightly
# image baked in, so a newly added Build-Depends would fail here — and
# not in the .deb job, which installs them — until the image caught up.
shell: bash
run: |
set -euo pipefail
apt-get update && apt-get build-dep ./contrib -y
- name: Build and run C++ unit tests
shell: bash
run: |
set -euo pipefail
cmake --preset default
cmake --build --preset default --target cpp-ci-tests
ctest --test-dir build --output-on-failure --no-tests=error -L "^cpp-ci$"
build-lemonade-debian13:
name: Build Lemonade .deb Package (Debian 13)${{ matrix.job-suffix }}
# Packaging-only variant: the merge queue gates every merge, so PR pushes
# skip it. Any Debian 13 build break still blocks at merge-queue time.
# Label a PR `ci:distros` to opt it back in.
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:distros')
runs-on: ${{ matrix.runs-on }}
outputs:
version: ${{ steps.get_version.outputs.version }}
container:
image: debian:trixie
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
include:
- arch-name: X86_64
runs-on: ubuntu-latest
deb-arch: amd64
artifact-suffix: x86_64
job-suffix: ""
- arch-name: ARM64
runs-on: ubuntu-24.04-arm
deb-arch: arm64
artifact-suffix: arm64
job-suffix: " (ARM64)"
steps:
- name: Enable Trixie backports
run: |
echo "deb http://deb.debian.org/debian trixie-backports main" > /etc/apt/sources.list.d/trixie-backports.list
- name: Install git
run: |
set -e
apt-get update
apt-get install -y git
- name: Install from backports
run: |
set -e
apt-get install -y -t trixie-backports libcpp-httplib-dev node-markdown-it-texmath
- uses: actions/checkout@v5
with:
clean: true
fetch-depth: 0
- name: Configure git safe directory
run: git config --global --add safe.directory $(pwd)
- name: Prepare Debian build
id: get_version
uses: ./.github/actions/prepare-debian-build
with:
release: '13'
codename: 'trixie'
- name: Build Debian package
id: build_deb
uses: ./.github/actions/build-debian-package
with:
package-type: binary
deb-version: ${{ steps.get_version.outputs.version }}
- name: Rename server .deb for release
id: rename
shell: bash
run: |
set -e
VERSION="${{ steps.get_version.outputs.version }}"
OUTPUT_DIR="${{ steps.build_deb.outputs.output-dir }}"
SRC=$(ls "$OUTPUT_DIR"/lemonade-server_*_${{ matrix.deb-arch }}.deb | head -n1)
if [ -z "$SRC" ]; then
echo "ERROR: server .deb not found in $OUTPUT_DIR"
ls -la "$OUTPUT_DIR"
exit 1
fi
DEST="$OUTPUT_DIR/lemonade-server_${VERSION}-debian13_${{ matrix.deb-arch }}.deb"
mv "$SRC" "$DEST"
echo "Renamed $SRC -> $DEST"
echo "deb-path=$DEST" >> $GITHUB_OUTPUT
- name: Upload .deb package
uses: actions/upload-artifact@v7
with:
name: lemonade-debian13-${{ matrix.artifact-suffix }}
path: ${{ steps.rename.outputs.deb-path }}
retention-days: 7
test-lemonade-debian13-smoke:
name: Smoke test .deb (Debian 13)${{ matrix.job-suffix }}
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:distros')
runs-on: ${{ matrix.runs-on }}
needs: build-lemonade-debian13
container:
image: debian:trixie
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
include:
- arch-name: X86_64
runs-on: ubuntu-latest
deb-arch: amd64
artifact-suffix: x86_64
job-suffix: ""
- arch-name: ARM64
runs-on: ubuntu-24.04-arm
deb-arch: arm64
artifact-suffix: arm64
job-suffix: " (ARM64)"
env:
LEMONADE_VERSION: ${{ needs.build-lemonade-debian13.outputs.version }}
steps:
- name: Download Lemonade .deb Package
uses: actions/download-artifact@v7
with:
name: lemonade-debian13-${{ matrix.artifact-suffix }}
path: .
- name: Install and smoke test
shell: bash
run: |
set -e
DEB_FILE=$(ls lemonade-server_*-debian13_${{ matrix.deb-arch }}.deb 2>/dev/null | head -n1)
if [ -z "$DEB_FILE" ]; then
echo "ERROR: .deb file not found"
ls -la *.deb 2>/dev/null || echo "No .deb files found in current directory"
exit 1
fi
echo "Debian 13 ${{ matrix.arch-name }} version: $(cat /etc/os-release | grep PRETTY_NAME)"
echo "Testing artifact: $DEB_FILE"
echo "deb http://deb.debian.org/debian trixie-backports main" > /etc/apt/sources.list.d/trixie-backports.list
apt-get update
apt-get install -y curl
apt-get install -y -t trixie-backports ./"$DEB_FILE"
/usr/bin/lemond --version
/usr/bin/lemonade --version
echo "Package installed successfully"
mkdir -p "$RUNNER_TEMP/xdg-runtime"
chmod 700 "$RUNNER_TEMP/xdg-runtime"
export XDG_RUNTIME_DIR="$RUNNER_TEMP/xdg-runtime"
/usr/bin/lemond "$(pwd)" > "$RUNNER_TEMP/lemonade-server.log" 2>&1 &
SERVER_PID=$!
echo "Server started (PID $SERVER_PID)"
for i in $(seq 1 30); do
if curl -sf http://127.0.0.1:13305/live > /dev/null 2>&1; then
echo "Server is running and healthy on port 13305"
break
fi
if ! kill -0 $SERVER_PID 2>/dev/null; then
echo "ERROR: Server process exited prematurely"
echo "=== Server log ==="
cat "$RUNNER_TEMP/lemonade-server.log" 2>/dev/null || echo "(no log)"
exit 1
fi
echo "Waiting for server... ($i/30)"
sleep 2
done
kill $SERVER_PID 2>/dev/null || true
build-lemonade-rpm:
name: Build Lemonade .rpm - Fedora ${{ matrix.fedora-version }}${{ matrix.job-suffix }}
# Packaging-only variant: the merge queue gates every merge, so PR pushes
# skip it. Any Fedora build break still blocks at merge-queue time.
# Label a PR `ci:distros` to opt it back in.
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:distros')
runs-on: ${{ matrix.runs-on }}
container:
image: fedora:${{ matrix.fedora-version }}
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
fedora-version: ["43", "44"]
runs-on: ["ubuntu-latest", "ubuntu-24.04-arm"]
include:
- runs-on: ubuntu-latest
arch-name: X86_64
rpm-arch: x86_64
artifact-suffix: x86_64
job-suffix: ""
- runs-on: ubuntu-24.04-arm
arch-name: ARM64
rpm-arch: aarch64
artifact-suffix: arm64
job-suffix: " (ARM64)"
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v5
with:
clean: true
fetch-depth: 0
- name: Install RPM packaging tools
shell: bash
run: |
set -e
dnf install -y rpm-build
- name: Get version from CMakeLists.txt
id: get_version
uses: ./.github/actions/get-version
- name: Build Linux .rpm package
shell: bash
run: |
set -e
echo "Running setup.sh to configure build environment..."
bash setup.sh
# setup.sh configures with testing on, and the build below has no
# --target, so every unit-test binary would be built and then left out
# of the .rpm. Same reasoning as BUILD_TESTING=OFF in contrib/debian/rules.
echo "Reconfiguring without the unit-test targets..."
cmake --preset default -DBUILD_TESTING=OFF
echo "Building lemond and lemonade for Fedora ${{ matrix.fedora-version }} (${{ matrix.arch-name }})..."
cmake --build --preset default
cd build
echo "Creating .rpm package with CPack..."
cpack -G RPM -V
CPACK_RPM="lemonade-server-${LEMONADE_VERSION}.${{ matrix.rpm-arch }}.rpm"
RPM_FILE="lemonade-server-${LEMONADE_VERSION}-fc${{ matrix.fedora-version }}.${{ matrix.rpm-arch }}.rpm"
if [ ! -f "$CPACK_RPM" ]; then
echo "ERROR: .rpm package not created!"
echo "Contents of build directory:"
ls -lR .
exit 1
fi
mv "$CPACK_RPM" "$RPM_FILE"
echo "Package information:"
rpm -qip "$RPM_FILE"
- name: Upload .rpm package
uses: actions/upload-artifact@v7
with:
name: lemonade-rpm-fedora-${{ matrix.fedora-version }}-${{ matrix.artifact-suffix }}
path: build/lemonade-server-${{ env.LEMONADE_VERSION }}-fc${{ matrix.fedora-version }}.${{ matrix.rpm-arch }}.rpm
retention-days: 7
build-lemonade-macos-dmg:
name: Build Lemonade macOS .dmg (with Tauri App)
# macOS runners are the scarcest GitHub-hosted resource (org-wide cap: 5
# concurrent) and observed queue waits reach 40+ minutes. Build Embeddable
# Lemonade (macOS) stays on PR pushes as the AppleClang compile canary; the
# Tauri/dmg/pkg surface is packaging-only, so it gates at merge-queue time.
# Label a PR `ci:macos` to opt it back in.
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:macos')
runs-on: macos-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
env:
HF_TOKEN: ${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v5
with:
clean: true
fetch-depth: 0
- name: Get version from CMakeLists.txt
id: get_version
uses: ./.github/actions/get-version
- name: Check signing secrets
id: check_signing
shell: bash
env:
APP_CONNECT_KEY: ${{ secrets.MACOS_APP_CONNECT_KEY_GERAMY }}
run: |
if [ "${{ inputs.disable_macos_signing }}" == "true" ]; then
echo "has_signing=false" >> $GITHUB_OUTPUT
echo "Signing disabled by workflow_dispatch input - exercising the unsigned path"
elif [ -n "$APP_CONNECT_KEY" ]; then
echo "has_signing=true" >> $GITHUB_OUTPUT
echo "Signing secrets available - will build signed and notarized .pkg"
else
echo "has_signing=false" >> $GITHUB_OUTPUT
echo "No signing secrets - will build an unsigned .pkg without notarizing"
fi
- name: Setup macOS Keychain
if: steps.check_signing.outputs.has_signing == 'true'
uses: ./.github/actions/setup-macos-keychain
with:
dev-signing-key: ${{ secrets.MACOS_DEV_SIGNING_IDENTITY_KEY }}
inst-signing-key: ${{ secrets.MACOS_INST_SIGNING_IDENTITY_KEY }}
certificate-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
api-key: ${{ secrets.MACOS_APP_CONNECT_KEY_GERAMY }}
api-key-id: '3WFZZ8F948'
api-issuer-id: '2e545619-8206-4d14-9ba9-ef23eff841b2'
- name: Build macOS .dmg
uses: ./.github/actions/build-macos-dmg
with:
include-tauri: 'true'
sign: ${{ steps.check_signing.outputs.has_signing }}
- name: Run C++ unit tests
shell: bash
run: |
set -euo pipefail
cmake --build --preset default --target cpp-ci-tests
ctest --test-dir build --output-on-failure --no-tests=error -L "^cpp-ci$"
- name: Upload .pkg package
# Two test jobs download this unconditionally; a unit-test failure above
# must not turn into a confusing "artifact not found" downstream.
if: always()
uses: actions/upload-artifact@v7
with:
name: lemonade-macos-pkg
path: build/*.pkg
retention-days: 7
- name: Cleanup keychain
if: always() && steps.check_signing.outputs.has_signing == 'true'
shell: bash
run: |
if [ -n "$SIGNING_KEYCHAIN_PATH" ] && [ -f "$SIGNING_KEYCHAIN_PATH" ]; then
echo "Cleaning up temporary keychain..."
security delete-keychain "$SIGNING_KEYCHAIN_PATH" 2>/dev/null || true
fi
build-lemonade-embeddable-linux:
name: Build Embeddable Lemonade (Linux${{ matrix.job-suffix }})
runs-on: ${{ matrix.runs-on }}
outputs:
version: ${{ steps.get_version.outputs.version }}
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
include:
- arch-name: X86_64
runs-on: ubuntu-latest
platform: ubuntu-x64
artifact-suffix: x86_64
job-suffix: ""
- arch-name: ARM64
runs-on: ubuntu-24.04-arm
platform: ubuntu-arm64
artifact-suffix: arm64
job-suffix: " ARM64"
steps:
- uses: actions/checkout@v4
with:
clean: true
fetch-depth: 0
- name: Get version from CMakeLists.txt
id: get_version
uses: ./.github/actions/get-version
- name: Install minimal build dependencies
run: |
set -e
sudo apt-get update
sudo apt-get install -y cmake ninja-build g++ pkg-config libssl-dev libdrm-dev
- name: Build embeddable archive
shell: bash
run: |
set -e
# Do not use setup.sh — we intentionally avoid installing system
# libraries so that FetchContent statically links all deps, making
# the embeddable binary portable across Ubuntu versions.
cmake --preset default -DBUILD_WEB_APP=OFF
cmake --build --preset default --target embeddable
ARCHIVE="build/lemonade-embeddable-${LEMONADE_VERSION}-${{ matrix.platform }}.tar.gz"
test -f "$ARCHIVE"
echo "Archive contents:"
tar tzf "$ARCHIVE"
ls -lh "$ARCHIVE"
- name: Upload embeddable archive
uses: actions/upload-artifact@v4
with:
name: lemonade-embeddable-linux-${{ matrix.artifact-suffix }}
path: build/lemonade-embeddable-${{ env.LEMONADE_VERSION }}-${{ matrix.platform }}.tar.gz
retention-days: 7
build-lemonade-linux-arm64:
name: Build Lemonade (Linux ARM64)
runs-on: ubuntu-24.04-arm
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v5
with:
clean: true
fetch-depth: 0
- name: Get version from CMakeLists.txt
id: get_version
uses: ./.github/actions/get-version
- name: Install build dependencies
run: |
set -e
sudo apt-get update
sudo apt-get install -y cmake ninja-build g++ pkg-config libssl-dev libdrm-dev
- name: Build
run: |
set -e
cmake --preset default -DBUILD_WEB_APP=OFF
cmake --build --preset default --target lemond lemonade
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: lemonade-linux-arm64-build
path: |
build/lemond
build/lemonade
build/resources/
retention-days: 7
build-lemonade-embeddable-windows:
name: Build Embeddable Lemonade (Windows)
runs-on: windows-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
clean: true
fetch-depth: 0
- name: Install CMake if not available
uses: ./.github/actions/install-cmake-windows
- name: Get version from CMakeLists.txt
id: get_version
uses: ./.github/actions/get-version
- name: Cache FetchContent dependencies
uses: actions/cache@v4
with:
path: build/_deps
# vs2026 marker: see installer job — VS 2022-built _deps cannot be
# reused by the VS 2026 configure.
key: fetchcontent-windows-embeddable-vs2026-${{ hashFiles('CMakeLists.txt') }}
restore-keys: fetchcontent-windows-embeddable-vs2026-
- name: Build embeddable archive
shell: PowerShell
run: |
$ErrorActionPreference = "Stop"
cmake --preset vs18 -DBUILD_WEB_APP=OFF
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cmake --build build --config Release --target embeddable -- /m:2
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$archive = "build\lemonade-embeddable-$($env:LEMONADE_VERSION)-windows-x64.zip"
if (-not (Test-Path $archive)) { throw "Archive not found: $archive" }
Write-Host "Archive created:" -ForegroundColor Green
Get-ChildItem $archive
- name: Upload embeddable archive
uses: actions/upload-artifact@v4
with:
name: lemonade-embeddable-windows
path: build/lemonade-embeddable-${{ env.LEMONADE_VERSION }}-windows-x64.zip
retention-days: 7
build-lemonade-embeddable-macos:
name: Build Embeddable Lemonade (macOS)
runs-on: macos-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
clean: true
fetch-depth: 0
- name: Get version from CMakeLists.txt
id: get_version
uses: ./.github/actions/get-version
- name: Install minimal build dependencies
shell: bash
run: |
set -e
# macos-latest already ships cmake; install ninja if missing.
# We intentionally avoid setup.sh so FetchContent statically links
# deps where possible, matching the Linux/Windows embeddable jobs.
if ! command -v ninja >/dev/null 2>&1; then
brew install ninja
fi
- name: Build embeddable archive
shell: bash
run: |
set -e
cmake --preset default -DBUILD_WEB_APP=OFF
cmake --build --preset default --target embeddable
ARCHIVE="build/lemonade-embeddable-${LEMONADE_VERSION}-macos-arm64.tar.gz"
test -f "$ARCHIVE"
echo "Archive contents:"
tar tzf "$ARCHIVE"
ls -lh "$ARCHIVE"
- name: Upload embeddable archive
uses: actions/upload-artifact@v4
with:
name: lemonade-embeddable-macos
path: build/lemonade-embeddable-${{ env.LEMONADE_VERSION }}-macos-arm64.tar.gz
retention-days: 7
# ========================================================================
# TEST JOBS - Inference tests on self-hosted runners
# ========================================================================
test-exe-inference:
name: Test .exe - ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
needs: build-lemonade-server-installer
# Skip inference tests when signing is enabled (tag pushes or manual workflow_dispatch).
# Self-hosted rig capacity is the binding constraint, so the merge queue runs
# these instead of PR pushes. Label a PR `ci:backends` to opt it back in.
if: >-
!startsWith(github.ref, 'refs/tags/') &&
inputs.enable_signing != true &&
inputs.disable_macos_signing != true &&
(github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci:backends'))
strategy: