-
Notifications
You must be signed in to change notification settings - Fork 342
1671 lines (1466 loc) · 60.5 KB
/
Copy pathrelease.yml
File metadata and controls
1671 lines (1466 loc) · 60.5 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: Build Packages
on:
push:
tags:
- "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].[0-9][0-9]"
workflow_dispatch:
inputs:
dry_run:
description: "Build release packages without publishing artifacts, images, or release assets"
required: false
default: false
type: boolean
pre_release:
description: "Publish as pre-release (builds and uploads artifacts but skips Homebrew tap, deploy templates, and releases.json updates)"
required: false
default: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
env:
NIGHTLY_TOOLCHAIN: nightly-2025-11-30
RELEASE_DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run && 'true' || 'false' }}
RELEASE_PRE_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.pre_release && 'true' || 'false' }}
jobs:
zizmor:
name: Workflow Security
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Dry-run short-circuit
if: ${{ env.RELEASE_DRY_RUN == 'true' }}
run: echo "Dry run enabled, skipping workflow security checks"
- uses: zizmorcore/zizmor-action@135698455da5c3b3e55f73f4419e481ab68cdd95 # v0.4.1
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
advanced-security: false
online-audits: false
validate-tag:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
name: Validate Tag Format
permissions:
contents: read
steps:
- name: Check tag matches YYYYMMDD.NN
env:
TAG: ${{ github.ref_name }}
run: |
if [[ ! "$TAG" =~ ^[0-9]{8}\.[0-9]{2}$ ]]; then
echo "::error::Tag '$TAG' must match YYYYMMDD.NN format"
exit 1
fi
biome:
needs: zizmor
runs-on: ubuntu-latest
name: Biome
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Dry-run short-circuit
if: ${{ env.RELEASE_DRY_RUN == 'true' }}
run: echo "Dry run enabled, skipping biome checks"
- uses: biomejs/setup-biome@29711cbb52afee00eb13aeb30636592f9edc0088 # v2.7.0
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
version: "2.4.6"
- if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: biome ci crates/web/ui/src/ crates/web/ui/e2e/
- if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: ./scripts/i18n-check.sh
fmt:
needs: zizmor
runs-on: ubuntu-latest
name: Format
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Dry-run short-circuit
if: ${{ env.RELEASE_DRY_RUN == 'true' }}
run: echo "Dry run enabled, skipping rustfmt check"
- uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
components: rustfmt
- if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: cargo fmt --all -- --check
clippy:
needs: [fmt, biome]
runs-on: [self-hosted, Linux, X64]
container:
image: nvidia/cuda:12.4.1-devel-ubuntu22.04
env:
LD_LIBRARY_PATH: /usr/local/cuda/compat:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
name: Clippy
permissions:
contents: read
steps:
- name: Install git for proper clone (CUDA image has none)
run: apt-get update -qq && apt-get install -y -qq --no-install-recommends git ca-certificates >/dev/null
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Mark workspace safe for gix (container uid mismatch)
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Dry-run short-circuit
if: ${{ env.RELEASE_DRY_RUN == 'true' }}
run: echo "Dry run enabled, skipping clippy job"
- name: Clean up corrupted cargo config
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: rm -f ~/.cargo/config.toml
- name: Install build dependencies
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: bash ./scripts/install-linux-build-deps.sh
- uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
components: clippy, rustfmt
- name: Initialize git repo in llama-cpp source to satisfy cmake
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: |
cargo fetch --locked
LLAMA_SRC=$(find ~/.cargo/registry/src -name "llama-cpp-sys-2-*" -type d 2>/dev/null | head -1)
if [ -n "$LLAMA_SRC" ] && [ ! -d "$LLAMA_SRC/.git" ]; then
cd "$LLAMA_SRC"
git init
git config user.email "ci@example.com"
git config user.name "CI"
git add -A
git commit -m "init" --allow-empty
git tag v0.0.0
fi
- name: Build Tailwind CSS
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: |
./scripts/download-tailwindcss-cli.sh tailwindcss-linux-x64
cd crates/web/ui && TAILWINDCSS=../../../tailwindcss-linux-x64 ./build.sh
- if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: cargo clippy -Z unstable-options --workspace --all-features --all-targets --timings -- -D warnings
test:
needs: [fmt, biome]
runs-on: [self-hosted, Linux, X64]
container:
image: nvidia/cuda:12.4.1-devel-ubuntu22.04
env:
LD_LIBRARY_PATH: /usr/local/cuda/compat:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
name: Test
permissions:
contents: read
steps:
- name: Install git for proper clone (CUDA image has none)
run: apt-get update -qq && apt-get install -y -qq --no-install-recommends git ca-certificates >/dev/null
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Mark workspace safe for gix (container uid mismatch)
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Dry-run short-circuit
if: ${{ env.RELEASE_DRY_RUN == 'true' }}
run: echo "Dry run enabled, skipping unit test job"
- name: Clean up corrupted cargo config
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: rm -f ~/.cargo/config.toml
- name: Install build dependencies
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: bash ./scripts/install-linux-build-deps.sh
- uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
toolchain: stable
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
node-version: "22"
package-manager-cache: false
- name: Install QMD CLI
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: |
npm install -g @tobilu/qmd
qmd --version
- uses: taiki-e/install-action@f176c07a0a40cbfdd08ee9aa8bf1655701d11e69 # v2.67.25
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
tool: cargo-nextest
- name: Initialize git repo in llama-cpp source to satisfy cmake
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: |
cargo fetch --locked
LLAMA_SRC=$(find ~/.cargo/registry/src -name "llama-cpp-sys-2-*" -type d 2>/dev/null | head -1)
if [ -n "$LLAMA_SRC" ] && [ ! -d "$LLAMA_SRC/.git" ]; then
cd "$LLAMA_SRC"
git init
git config user.email "ci@example.com"
git config user.name "CI"
git add -A
git commit -m "init" --allow-empty
git tag v0.0.0
fi
- name: Build Tailwind CSS
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: |
./scripts/download-tailwindcss-cli.sh tailwindcss-linux-x64
cd crates/web/ui && TAILWINDCSS=../../../tailwindcss-linux-x64 ./build.sh
- if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: cargo nextest run --all-features --profile ci
e2e:
name: E2E Tests
needs: [fmt, biome]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Dry-run short-circuit
if: ${{ env.RELEASE_DRY_RUN == 'true' }}
run: echo "Dry run enabled, skipping E2E job"
- uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
toolchain: stable
- name: Build Tailwind CSS
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: |
./scripts/download-tailwindcss-cli.sh tailwindcss-linux-x64
cd crates/web/ui && TAILWINDCSS=../../../tailwindcss-linux-x64 ./build.sh
- name: Build moltis binary
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
run: cargo build --bin moltis
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
with:
node-version: "22"
package-manager-cache: false
- name: Install npm dependencies
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
working-directory: crates/web/ui
run: npm ci
- name: Install Playwright browsers
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
working-directory: crates/web/ui
run: npx playwright install --with-deps chromium
- name: Run E2E tests
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
working-directory: crates/web/ui
env:
CI: "true"
run: npx playwright test
- name: Upload test results
if: ${{ !cancelled() && env.RELEASE_DRY_RUN != 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: e2e-test-results-${{ github.run_id }}-${{ github.run_attempt }}
path: |
crates/web/ui/playwright-report/
crates/web/ui/test-results/
if-no-files-found: ignore
retention-days: 14
build-deb:
needs: [clippy, test, e2e]
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
arch: amd64
os: ubuntu-22.04
- target: aarch64-unknown-linux-gnu
arch: arm64
os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
name: Build .deb (${{ matrix.arch }})
permissions:
contents: read
id-token: write # Required for Sigstore keyless signing
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Resolve release version
id: release_version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME}"
else
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
with:
toolchain: stable
targets: ${{ matrix.target }}, wasm32-wasip2
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Install cosign
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
- name: Build Tailwind CSS
run: |
ARCH=$(uname -m)
case "$ARCH" in x86_64) TW="tailwindcss-linux-x64";; aarch64) TW="tailwindcss-linux-arm64";; esac
./scripts/download-tailwindcss-cli.sh "$TW"
cd crates/web/ui && TAILWINDCSS="../../../$TW" ./build.sh
- name: Build WASM components
run: |
cargo build --target wasm32-wasip2 -p moltis-wasm-calc -p moltis-wasm-web-fetch -p moltis-wasm-web-search --release
cargo run -p moltis-wasm-precompile --release
- name: Build release binary
env:
BUILD_TARGET: ${{ matrix.target }}
MOLTIS_VERSION: ${{ steps.release_version.outputs.version }}
run: cargo build --release --target "$BUILD_TARGET"
- name: Stage WASM assets for cargo-deb
env:
BUILD_TARGET: ${{ matrix.target }}
run: bash ./scripts/stage-wasm-package-assets.sh "target/$BUILD_TARGET/release"
- name: Build .deb package
env:
BUILD_TARGET: ${{ matrix.target }}
MOLTIS_VERSION: ${{ steps.release_version.outputs.version }}
run: cargo deb -p moltis --no-build --target "$BUILD_TARGET" --deb-version "$MOLTIS_VERSION"
- name: Sign with Sigstore and generate checksums
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: ./.github/actions/sign-artifacts
with:
files: '*.deb'
working-directory: target/${{ matrix.target }}/debian
- name: Upload .deb artifact
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: moltis-${{ matrix.arch }}.deb
path: |
target/${{ matrix.target }}/debian/*.deb
target/${{ matrix.target }}/debian/*.sha256
target/${{ matrix.target }}/debian/*.sha512
target/${{ matrix.target }}/debian/*.sig
target/${{ matrix.target }}/debian/*.crt
build-rpm:
needs: [clippy, test, e2e]
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
arch: x86_64
os: ubuntu-22.04
- target: aarch64-unknown-linux-gnu
arch: aarch64
os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
name: Build .rpm (${{ matrix.arch }})
permissions:
contents: read
id-token: write # Required for Sigstore keyless signing
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Resolve release version
id: release_version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME}"
else
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
with:
toolchain: stable
targets: ${{ matrix.target }}, wasm32-wasip2
- name: Install cargo-generate-rpm
run: cargo install cargo-generate-rpm
- name: Install cosign
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
- name: Build Tailwind CSS
run: |
ARCH=$(uname -m)
case "$ARCH" in x86_64) TW="tailwindcss-linux-x64";; aarch64) TW="tailwindcss-linux-arm64";; esac
./scripts/download-tailwindcss-cli.sh "$TW"
cd crates/web/ui && TAILWINDCSS="../../../$TW" ./build.sh
- name: Build WASM components
run: |
cargo build --target wasm32-wasip2 -p moltis-wasm-calc -p moltis-wasm-web-fetch -p moltis-wasm-web-search --release
cargo run -p moltis-wasm-precompile --release
- name: Build release binary
env:
BUILD_TARGET: ${{ matrix.target }}
MOLTIS_VERSION: ${{ steps.release_version.outputs.version }}
run: cargo build --release --target "$BUILD_TARGET"
- name: Build .rpm package
env:
BUILD_TARGET: ${{ matrix.target }}
MOLTIS_VERSION: ${{ steps.release_version.outputs.version }}
run: cargo generate-rpm -p crates/cli --target "$BUILD_TARGET" --set-metadata="version=\"$MOLTIS_VERSION\""
- name: Sign with Sigstore and generate checksums
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: ./.github/actions/sign-artifacts
with:
files: '*.rpm'
working-directory: target/${{ matrix.target }}/generate-rpm
- name: Upload .rpm artifact
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: moltis-${{ matrix.arch }}.rpm
path: |
target/${{ matrix.target }}/generate-rpm/*.rpm
target/${{ matrix.target }}/generate-rpm/*.sha256
target/${{ matrix.target }}/generate-rpm/*.sha512
target/${{ matrix.target }}/generate-rpm/*.sig
target/${{ matrix.target }}/generate-rpm/*.crt
build-arch:
needs: [clippy, test, e2e]
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
arch: x86_64
os: ubuntu-22.04
- target: aarch64-unknown-linux-gnu
arch: aarch64
os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
name: Build .pkg.tar.zst (${{ matrix.arch }})
permissions:
contents: read
id-token: write # Required for Sigstore keyless signing
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
with:
toolchain: stable
targets: ${{ matrix.target }}, wasm32-wasip2
- name: Install packaging tools
run: sudo apt-get update && sudo apt-get install -y fakeroot zstd
- name: Install cosign
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
- name: Build Tailwind CSS
run: |
ARCH=$(uname -m)
case "$ARCH" in x86_64) TW="tailwindcss-linux-x64";; aarch64) TW="tailwindcss-linux-arm64";; esac
./scripts/download-tailwindcss-cli.sh "$TW"
cd crates/web/ui && TAILWINDCSS="../../../$TW" ./build.sh
- name: Build WASM components
run: |
cargo build --target wasm32-wasip2 -p moltis-wasm-calc -p moltis-wasm-web-fetch -p moltis-wasm-web-search --release
cargo run -p moltis-wasm-precompile --release
- name: Determine package version
id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME}"
else
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build release binary
env:
BUILD_TARGET: ${{ matrix.target }}
MOLTIS_VERSION: ${{ steps.version.outputs.version }}
run: cargo build --release --target "$BUILD_TARGET"
- name: Build .pkg.tar.zst
env:
VERSION: ${{ steps.version.outputs.version }}
BUILD_TARGET: ${{ matrix.target }}
MATRIX_ARCH: ${{ matrix.arch }}
run: |
PKG_DIR="pkg-root"
mkdir -p "$PKG_DIR/usr/bin" "$PKG_DIR/usr/share/moltis/web" "$PKG_DIR/usr/share/moltis/wasm"
cp "target/$BUILD_TARGET/release/moltis" "$PKG_DIR/usr/bin/moltis"
chmod 755 "$PKG_DIR/usr/bin/moltis"
cp -R crates/web/src/assets/. "$PKG_DIR/usr/share/moltis/web/"
cp "target/wasm32-wasip2/release/moltis_wasm_calc.wasm" "$PKG_DIR/usr/share/moltis/wasm/"
cp "target/wasm32-wasip2/release/moltis_wasm_web_fetch.wasm" "$PKG_DIR/usr/share/moltis/wasm/"
cp "target/wasm32-wasip2/release/moltis_wasm_web_search.wasm" "$PKG_DIR/usr/share/moltis/wasm/"
cat > "$PKG_DIR/.PKGINFO" <<PKGINFO
pkgname = moltis
pkgver = ${VERSION}-1
pkgdesc = Personal AI gateway inspired by OpenClaw
url = https://www.moltis.org/
arch = $MATRIX_ARCH
license = MIT
PKGINFO
cd "$PKG_DIR"
fakeroot -- tar --zstd -cf "../moltis-${VERSION}-1-${MATRIX_ARCH}.pkg.tar.zst" .PKGINFO usr/
- name: Sign with Sigstore and generate checksums
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: ./.github/actions/sign-artifacts
with:
files: moltis-${{ steps.version.outputs.version }}-1-${{ matrix.arch }}.pkg.tar.zst
- name: Upload .pkg.tar.zst artifact
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: moltis-${{ matrix.arch }}.pkg.tar.zst
path: |
*.pkg.tar.zst
*.pkg.tar.zst.sha256
*.pkg.tar.zst.sha512
*.pkg.tar.zst.sig
*.pkg.tar.zst.crt
build-appimage:
needs: [clippy, test, e2e]
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
arch: x86_64
os: ubuntu-22.04
appimagetool_arch: x86_64
- target: aarch64-unknown-linux-gnu
arch: aarch64
os: ubuntu-24.04-arm
appimagetool_arch: aarch64
runs-on: ${{ matrix.os }}
name: Build AppImage (${{ matrix.arch }})
permissions:
contents: read
id-token: write # Required for Sigstore keyless signing
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
with:
toolchain: stable
targets: ${{ matrix.target }}, wasm32-wasip2
- name: Install cosign
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
- name: Build Tailwind CSS
run: |
ARCH=$(uname -m)
case "$ARCH" in x86_64) TW="tailwindcss-linux-x64";; aarch64) TW="tailwindcss-linux-arm64";; esac
./scripts/download-tailwindcss-cli.sh "$TW"
cd crates/web/ui && TAILWINDCSS="../../../$TW" ./build.sh
- name: Build WASM components
run: |
cargo build --target wasm32-wasip2 -p moltis-wasm-calc -p moltis-wasm-web-fetch -p moltis-wasm-web-search --release
cargo run -p moltis-wasm-precompile --release
- name: Determine package version
id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME}"
else
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build release binary
env:
BUILD_TARGET: ${{ matrix.target }}
MOLTIS_VERSION: ${{ steps.version.outputs.version }}
run: cargo build --release --target "$BUILD_TARGET"
- name: Build AppImage
env:
VERSION: ${{ steps.version.outputs.version }}
BUILD_TARGET: ${{ matrix.target }}
MATRIX_ARCH: ${{ matrix.arch }}
APPIMAGETOOL_ARCH: ${{ matrix.appimagetool_arch }}
run: |
# Download appimagetool matching the runner architecture
wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${APPIMAGETOOL_ARCH}.AppImage" -O appimagetool
chmod +x appimagetool
# Build AppDir structure
APP_DIR="moltis.AppDir"
mkdir -p "$APP_DIR/usr/bin" "$APP_DIR/usr/share/moltis/web" "$APP_DIR/usr/share/moltis/wasm"
cp "target/$BUILD_TARGET/release/moltis" "$APP_DIR/usr/bin/moltis"
chmod 755 "$APP_DIR/usr/bin/moltis"
cp -R crates/web/src/assets/. "$APP_DIR/usr/share/moltis/web/"
cp "target/wasm32-wasip2/release/moltis_wasm_calc.wasm" "$APP_DIR/usr/share/moltis/wasm/"
cp "target/wasm32-wasip2/release/moltis_wasm_web_fetch.wasm" "$APP_DIR/usr/share/moltis/wasm/"
cp "target/wasm32-wasip2/release/moltis_wasm_web_search.wasm" "$APP_DIR/usr/share/moltis/wasm/"
# Create .desktop file
cat > "$APP_DIR/moltis.desktop" <<DESKTOP
[Desktop Entry]
Type=Application
Name=Moltis
Exec=moltis
Icon=moltis
Categories=Network;
Terminal=true
DESKTOP
# Create minimal icon
cat > "$APP_DIR/moltis.svg" <<SVG
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256"><rect width="256" height="256" fill="#333"/><text x="128" y="140" font-size="120" text-anchor="middle" fill="white">M</text></svg>
SVG
ln -s moltis.svg "$APP_DIR/.DirIcon"
# Create AppRun
cat > "$APP_DIR/AppRun" <<'APPRUN'
#!/bin/sh
SELF=$(readlink -f "$0")
HERE=${SELF%/*}
export MOLTIS_SHARE_DIR="$HERE/usr/share/moltis"
exec "$HERE/usr/bin/moltis" "$@"
APPRUN
chmod +x "$APP_DIR/AppRun"
# Package - use --appimage-extract-and-run to avoid FUSE requirement in CI
ARCH="$MATRIX_ARCH" ./appimagetool --appimage-extract-and-run "$APP_DIR" "moltis-${VERSION}-${MATRIX_ARCH}.AppImage"
- name: Sign with Sigstore and generate checksums
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: ./.github/actions/sign-artifacts
with:
files: moltis-${{ steps.version.outputs.version }}-${{ matrix.arch }}.AppImage
- name: Upload AppImage artifact
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: moltis-${{ matrix.arch }}.AppImage
path: |
*.AppImage
*.AppImage.sha256
*.AppImage.sha512
*.AppImage.sig
*.AppImage.crt
build-snap:
needs: [clippy, test, e2e]
runs-on: ubuntu-latest
name: Build Snap
permissions:
contents: read
id-token: write # Required for Sigstore keyless signing
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Resolve release version
id: release_version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME}"
else
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Sync snap version to release version
env:
VERSION: ${{ steps.release_version.outputs.version }}
run: |
sed -Ei "s/^version:[[:space:]]*'.*'/version: '${VERSION}'/" snap/snapcraft.yaml
- name: Install cosign
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
- uses: snapcore/action-build@3bdaa03e1ba6bf59a65f84a751d943d549a54e79 # v1
id: build-snap
- name: Sign with Sigstore and generate checksums
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: ./.github/actions/sign-artifacts
with:
files: ${{ steps.build-snap.outputs.snap }}
- name: Upload Snap artifact
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: moltis.snap
path: |
${{ steps.build-snap.outputs.snap }}
${{ steps.build-snap.outputs.snap }}.sha256
${{ steps.build-snap.outputs.snap }}.sha512
${{ steps.build-snap.outputs.snap }}.sig
${{ steps.build-snap.outputs.snap }}.crt
build-homebrew-binaries:
needs: [clippy, test, e2e]
strategy:
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
name: Build binary (${{ matrix.target }})
permissions:
contents: read
id-token: write # Required for Sigstore keyless signing
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
with:
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
targets: ${{ matrix.target }}, wasm32-wasip2
- name: Install cosign
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
- name: Build Tailwind CSS
run: |
OS=$(uname -s)
ARCH=$(uname -m)
case "${OS}-${ARCH}" in
Linux-x86_64) TW="tailwindcss-linux-x64";;
Linux-aarch64) TW="tailwindcss-linux-arm64";;
Darwin-arm64) TW="tailwindcss-macos-arm64";;
Darwin-x86_64) TW="tailwindcss-macos-x64";;
esac
./scripts/download-tailwindcss-cli.sh "$TW"
cd crates/web/ui && TAILWINDCSS="../../../$TW" ./build.sh
- name: Build WASM components
run: |
cargo build --target wasm32-wasip2 -p moltis-wasm-calc -p moltis-wasm-web-fetch -p moltis-wasm-web-search --release
cargo run -p moltis-wasm-precompile --release
- name: Determine package version
id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME}"
else
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build release binary
env:
BUILD_TARGET: ${{ matrix.target }}
MOLTIS_VERSION: ${{ steps.version.outputs.version }}
run: cargo build --release --target "$BUILD_TARGET"
- name: Package binary
env:
VERSION: ${{ steps.version.outputs.version }}
BUILD_TARGET: ${{ matrix.target }}
run: |
PKG_DIR="moltis-package"
mkdir -p "$PKG_DIR/share/moltis/web" "$PKG_DIR/share/moltis/wasm"
cp "target/$BUILD_TARGET/release/moltis" "$PKG_DIR/moltis"
cp -R crates/web/src/assets/. "$PKG_DIR/share/moltis/web/"
cp "target/wasm32-wasip2/release/moltis_wasm_calc.wasm" "$PKG_DIR/share/moltis/wasm/"
cp "target/wasm32-wasip2/release/moltis_wasm_web_fetch.wasm" "$PKG_DIR/share/moltis/wasm/"
cp "target/wasm32-wasip2/release/moltis_wasm_web_search.wasm" "$PKG_DIR/share/moltis/wasm/"
tar czf "moltis-${VERSION}-${BUILD_TARGET}.tar.gz" -C "$PKG_DIR" moltis share
- name: Sign with Sigstore and generate checksums
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: ./.github/actions/sign-artifacts
with:
files: moltis-${{ steps.version.outputs.version }}-${{ matrix.target }}.tar.gz
- name: Upload binary artifact
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: moltis-${{ matrix.target }}
path: |
*.tar.gz
*.tar.gz.sha256
*.tar.gz.sha512
*.tar.gz.sig
*.tar.gz.crt
build-macos-app:
needs: [clippy, test, e2e]
runs-on: macos-latest
name: Build macOS app
permissions:
contents: read
id-token: write # Required for Sigstore keyless signing
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master
with:
toolchain: stable
- name: Install Swift build dependencies
run: brew install xcodegen cbindgen
- name: Build Tailwind CSS
run: |
./scripts/download-tailwindcss-cli.sh tailwindcss-macos-arm64
cd crates/web/ui && TAILWINDCSS=../../../tailwindcss-macos-arm64 ./build.sh
- name: Install cosign
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
- name: Import Apple certificate
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
env:
APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
run: |
CERTIFICATE_PATH="$RUNNER_TEMP/certificate.p12"
KEYCHAIN_PATH="$RUNNER_TEMP/app-signing.keychain-db"
KEYCHAIN_PASSWORD="$(openssl rand -hex 16)"
echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > "$CERTIFICATE_PATH"
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security import "$CERTIFICATE_PATH" \
-P "$APPLE_CERTIFICATE_PASSWORD" \
-A -t cert -f pkcs12 \
-k "$KEYCHAIN_PATH"
security set-key-partition-list \
-S apple-tool:,apple: \
-k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security list-keychain -d user -a -s "$KEYCHAIN_PATH"
- name: Determine package version
id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME}"
else
VERSION="0.0.0-dev"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build Swift bridge artifacts and generate Xcode project
env:
MOLTIS_VERSION: ${{ steps.version.outputs.version }}
run: |
./scripts/build-swift-bridge.sh
./scripts/generate-swift-project.sh
- name: Build macOS app
env:
DERIVED_DATA_DIR: apps/macos/.derivedData-ci
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
if [[ "$RELEASE_DRY_RUN" == "true" ]]; then
EXTRA_FLAGS=(CODE_SIGNING_ALLOWED=NO)
else
EXTRA_FLAGS=(CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY="Developer ID Application" DEVELOPMENT_TEAM="${APPLE_TEAM_ID}" OTHER_CODE_SIGN_FLAGS="--options runtime")
fi
xcodebuild \
-project apps/macos/Moltis.xcodeproj \
-scheme Moltis \
-configuration Release \
-destination "platform=macOS" \
-derivedDataPath "$DERIVED_DATA_DIR" \
"${EXTRA_FLAGS[@]}" \
build
- name: Package macOS app
env:
VERSION: ${{ steps.version.outputs.version }}
APP_PATH: apps/macos/.derivedData-ci/Build/Products/Release/Moltis.app
run: |
if [ ! -d "$APP_PATH" ]; then
echo "expected app bundle not found at $APP_PATH" >&2
exit 1
fi
ditto -c -k --sequesterRsrc --keepParent "$APP_PATH" "moltis-${VERSION}-macos.app.zip"
- name: Notarize macOS app
if: ${{ env.RELEASE_DRY_RUN != 'true' }}
env:
VERSION: ${{ steps.version.outputs.version }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
xcrun notarytool submit "moltis-${VERSION}-macos.app.zip" \
--apple-id "$APPLE_ID" \
--password "$APPLE_ID_PASSWORD" \
--team-id "$APPLE_TEAM_ID" \
--wait
# Staple the notarization ticket to the app bundle
APP_PATH="apps/macos/.derivedData-ci/Build/Products/Release/Moltis.app"
xcrun stapler staple "$APP_PATH"
# Re-package with the stapled ticket
rm "moltis-${VERSION}-macos.app.zip"
ditto -c -k --sequesterRsrc --keepParent "$APP_PATH" "moltis-${VERSION}-macos.app.zip"