-
-
Notifications
You must be signed in to change notification settings - Fork 3
835 lines (835 loc) · 31.9 KB
/
CI.yml
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
name: CI
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
on:
push:
branches:
- main
tags-ignore:
- '**'
paths:
- '**/src/**/*.rs'
- '**/*.cjs'
- '**/*.js'
- '**/*.ts'
- '**/*.mjs'
- '**/*.java'
- '**/*.json'
- 'README.md'
- 'core/bin/codepoints.bin'
- 'bindings/native/docs/**'
- 'bindings/native/decancer.h'
- 'bindings/native/decancer.cpp'
- 'bindings/native/decancer.hpp'
pull_request: null
permissions:
contents: write
pages: write
id-token: write
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: latest
- name: Setup
id: setup
run: node scripts/ci_setup.mjs
env:
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
release: ${{ steps.setup.outputs.release }}
core_affected: ${{ steps.setup.outputs.core_affected }}
node_affected: ${{ steps.setup.outputs.node_affected }}
wasm_affected: ${{ steps.setup.outputs.wasm_affected }}
native_affected: ${{ steps.setup.outputs.native_affected }}
native_docs_affected: ${{ steps.setup.outputs.native_docs_affected }}
java_affected: ${{ steps.setup.outputs.java_affected }}
core:
name: Test core
runs-on: ubuntu-latest
needs:
- setup
if: ${{ needs.setup.outputs.release != 'null' || needs.setup.outputs.core_affected == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
with:
node-version: latest
- name: Ensure no default features is working
working-directory: core
run: cargo c --no-default-features
- name: Run cargo test
working-directory: core
run: cargo test --all-features
java-native:
strategy:
fail-fast: true
matrix:
settings:
- target: aarch64-apple-darwin
host: macos-latest
- target: aarch64-pc-windows-msvc
host: windows-latest
- target: aarch64-unknown-linux-gnu
host: ubuntu-latest
- target: aarch64-unknown-linux-musl
host: ubuntu-latest
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
rustup target add aarch64-unknown-linux-musl
cargo build --target aarch64-unknown-linux-musl --release
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip ./target/aarch64-unknown-linux-musl/release/libdecancer.so
mv ./target/aarch64-unknown-linux-musl/release/libdecancer.so ../../artifacts/libdecancer-aarch64-unknown-linux-musl.so
- target: arm-unknown-linux-gnueabi
host: ubuntu-latest
- target: armv5te-unknown-linux-gnueabi
host: ubuntu-latest
- target: armv7-unknown-linux-gnueabi
host: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
host: ubuntu-latest
- target: i686-pc-windows-msvc
host: windows-latest
- target: i686-unknown-freebsd
host: ubuntu-latest
- target: i686-unknown-linux-gnu
host: ubuntu-latest
- target: riscv64gc-unknown-linux-gnu
host: ubuntu-latest
- target: x86_64-apple-darwin
host: macos-latest
- target: x86_64-pc-windows-msvc
host: windows-latest
- target: x86_64-unknown-freebsd
host: ubuntu-latest
- target: x86_64-unknown-linux-gnu
host: ubuntu-latest
- target: x86_64-unknown-linux-musl
host: ubuntu-latest
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
cargo build --release
strip ./target/release/libdecancer.so
mv ./target/release/libdecancer.so ../../artifacts/libdecancer-x86_64-unknown-linux-musl.so
needs:
- setup
- core
if: ${{ always() && (needs.setup.outputs.release != 'null' || needs.setup.outputs.java_affected == 'true') }}
name: Build native java bindings on ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: latest
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
toolchain: stable
- name: Make artifacts directory
run: mkdir artifacts
shell: bash
- name: Build with cross
if: ${{ !matrix.settings.build }}
uses: houseabsolute/actions-rust-cross@v0
with:
working-directory: bindings/java
args: '--release --target-dir=.'
command: build
target: ${{ matrix.settings.target }}
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker && matrix.settings.build }}
with:
image: ${{ matrix.settings.docker }}
options: '--user 0:0 -v ${{ github.workspace }}/bindings/java/.cargo/registry/cache:/root/.cargo/registry/cache -v ${{ github.workspace }}/bindings/java/.cargo/registry/index:/root/.cargo/registry/index -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace}}/bindings/java'
run: ${{ matrix.settings.build }}
- name: Build
working-directory: bindings/java
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker && matrix.settings.build }}
shell: bash
- name: Move and rename binaries
if: ${{ !matrix.settings.build }}
run: node scripts/ci_native_artifacts.mjs ${{ matrix.settings.target }} --java
shell: bash
- name: Upload artifact
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: java-${{ matrix.settings.target }}
path: ./artifacts/**
if-no-files-found: error
java:
needs:
- setup
- java-native
if: ${{ always() && github.event_name != 'pull_request' && (needs.setup.outputs.release != 'null' || needs.setup.outputs.java_affected == 'true') }}
name: Test java bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 21
- uses: gradle/actions/setup-gradle@v3
- name: Download java artifact
uses: actions/download-artifact@v4
with:
name: java-x86_64-unknown-linux-gnu
path: bindings/java/bin
- name: Test
run: |
chmod +x ./gradlew
./gradlew test javadoc -DDECANCER_TESTING=1
working-directory: bindings/java
shell: bash
native:
strategy:
fail-fast: true
matrix:
settings:
- target: aarch64-apple-darwin
host: macos-latest
- target: aarch64-apple-ios
host: macos-latest
- target: aarch64-apple-ios-sim
host: macos-latest
- target: aarch64-linux-android
host: ubuntu-latest
build: |
rustup target add aarch64-linux-android
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
cargo build --target aarch64-linux-android --release
llvm-strip ./target/aarch64-linux-android/release/*.so
mv ./target/aarch64-linux-android/release/*.so ../../artifacts
- target: aarch64-pc-windows-msvc
host: windows-latest
- target: aarch64-unknown-linux-gnu
host: ubuntu-latest
- target: aarch64-unknown-linux-musl
host: ubuntu-latest
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
rustup target add aarch64-unknown-linux-musl
cargo build --target aarch64-unknown-linux-musl --release
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip ./target/aarch64-unknown-linux-musl/release/*.so
mv ./target/aarch64-unknown-linux-musl/release/*.so ../../artifacts
- target: arm-unknown-linux-gnueabi
host: ubuntu-latest
- target: armv5te-unknown-linux-gnueabi
host: ubuntu-latest
- target: armv7-linux-androideabi
host: ubuntu-latest
build: |
rustup target add armv7-linux-androideabi
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
cargo build --target armv7-linux-androideabi --release
llvm-strip ./target/armv7-linux-androideabi/release/*.so
mv ./target/armv7-linux-androideabi/release/*.so ../../artifacts
- target: armv7-unknown-linux-gnueabi
host: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
host: ubuntu-latest
- target: i586-unknown-linux-gnu
host: ubuntu-latest
- target: i686-pc-windows-msvc
host: windows-latest
- target: i686-unknown-freebsd
host: ubuntu-latest
- target: i686-unknown-linux-gnu
host: ubuntu-latest
- target: powerpc64le-unknown-linux-gnu
host: ubuntu-latest
- target: riscv64gc-unknown-linux-gnu
host: ubuntu-latest
- target: s390x-unknown-linux-gnu
host: ubuntu-latest
- target: sparcv9-sun-solaris
host: ubuntu-latest
- target: thumbv7neon-unknown-linux-gnueabihf
host: ubuntu-latest
- target: x86_64-apple-darwin
host: macos-latest
- target: x86_64-apple-ios
host: macos-latest
- target: x86_64-pc-windows-msvc
host: windows-latest
- target: x86_64-unknown-freebsd
host: ubuntu-latest
- target: x86_64-unknown-illumos
host: ubuntu-latest
- target: x86_64-unknown-linux-gnu
host: ubuntu-latest
- target: x86_64-unknown-linux-musl
host: ubuntu-latest
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
cargo build --release
strip ./target/release/*.so
mv ./target/release/*.so ../../artifacts
needs:
- setup
- core
if: ${{ always() && (needs.setup.outputs.release != 'null' || needs.setup.outputs.native_affected == 'true') }}
name: Build native bindings on ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: latest
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
toolchain: stable
- name: Make artifacts directory
run: mkdir artifacts
shell: bash
- name: Build with cross
if: ${{ !matrix.settings.build }}
uses: houseabsolute/actions-rust-cross@v0
with:
working-directory: bindings/native
args: '--release --target-dir=.'
command: build
target: ${{ matrix.settings.target }}
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker && matrix.settings.build }}
with:
image: ${{ matrix.settings.docker }}
options: '--user 0:0 -v ${{ github.workspace }}/bindings/native/.cargo/registry/cache:/root/.cargo/registry/cache -v ${{ github.workspace }}/bindings/native/.cargo/registry/index:/root/.cargo/registry/index -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace}}/bindings/native'
run: ${{ matrix.settings.build }}
- name: Build
working-directory: bindings/native
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker && matrix.settings.build }}
shell: bash
- name: Move binaries
if: ${{ !matrix.settings.build }}
run: node scripts/ci_native_artifacts.mjs ${{ matrix.settings.target }}
shell: bash
- name: Upload artifact
if: ${{ needs.setup.outputs.release != 'null' || matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
uses: actions/upload-artifact@v4
with:
name: native-${{ matrix.settings.target }}
path: ./artifacts/**
if-no-files-found: error
native-test:
name: Test native bindings
needs:
- setup
- native
if: ${{ always() && github.event_name != 'pull_request' && (needs.setup.outputs.release != 'null' || needs.setup.outputs.native_affected == 'true') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
with:
node-version: latest
cache: yarn
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: native-x86_64-unknown-linux-gnu
path: bindings/native
- name: Compile and run tests
working-directory: bindings/native/tests
run: node test.mjs
node:
strategy:
fail-fast: true
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: |
yarn build
strip -x *.node
- host: windows-latest
build: yarn build
target: x86_64-pc-windows-msvc
- host: windows-latest
build: yarn build --target i686-pc-windows-msvc
target: i686-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |
yarn build --target x86_64-unknown-linux-gnu
strip *.node
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
yarn build
strip *.node
- host: macos-latest
target: aarch64-apple-darwin
build: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
export CC=$(xcrun -f clang);
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
yarn build --target aarch64-apple-darwin
strip -x *.node
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |
yarn build --target aarch64-unknown-linux-gnu
aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
build: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
yarn build --target=armv7-unknown-linux-gnueabihf
arm-linux-gnueabihf-strip *.node
- host: ubuntu-latest
target: aarch64-linux-android
build: |
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
yarn build --target aarch64-linux-android
llvm-strip *.node
- host: ubuntu-latest
target: armv7-linux-androideabi
build: |
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
yarn build --target armv7-linux-androideabi
llvm-strip *.node
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
rustup target add aarch64-unknown-linux-musl
yarn build --target aarch64-unknown-linux-musl
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
- host: windows-latest
target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc
needs:
- setup
- core
if: ${{ always() && (needs.setup.outputs.release != 'null' || needs.setup.outputs.node_affected == 'true') }}
name: Build node bindings on ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
with:
node-version: latest
cache: yarn
- name: Install Rust
uses: actions-rs/toolchain@v1
if: ${{ !matrix.settings.docker }}
with:
profile: minimal
override: true
toolchain: stable
target: ${{ matrix.settings.target }}
- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
with:
version: 0.11.0
- name: Configure architecture to use with node
if: ${{ matrix.settings.target == 'i686-pc-windows-msvc' }}
run: yarn config set supportedArchitectures.cpu "ia32"
shell: bash
- uses: actions/setup-node@v4
if: ${{ matrix.settings.target == 'i686-pc-windows-msvc' }}
with:
node-version: latest
cache: yarn
architecture: x86
- name: Install dependencies
working-directory: bindings/node
run: yarn install
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: '--user 0:0 -v ${{ github.workspace }}/node/.cargo-cache/git/db:/root/.cargo/git/db -v ${{ github.workspace }}/bindings/node/.cargo/registry/cache:/root/.cargo/registry/cache -v ${{ github.workspace }}/bindings/node/.cargo/registry/index:/root/.cargo/registry/index -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace}}/bindings/node'
run: ${{ matrix.settings.build }}
- name: Build
working-directory: bindings/node
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
shell: bash
- name: Move artifact
run: mv ./bindings/node/decancer.*.node .
shell: bash
- name: Upload artifact
if: ${{ needs.setup.outputs.release != 'null' || matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
uses: actions/upload-artifact@v4
with:
name: node-${{ matrix.settings.target }}
path: decancer.*.node
if-no-files-found: error
#node-freebsd:
# runs-on: macos-12
# needs:
# - setup
# - core
# if: ${{ always() && (needs.setup.outputs.release != 'null' || needs.setup.outputs.node_affected == 'true') }}
# name: Build node bindings on FreeBSD
# steps:
# - uses: actions/checkout@v4
# - name: Build
# id: build
# uses: cross-platform-actions/action@v0.23.0
# timeout-minutes: 30
# env:
# DEBUG: napi:*
# RUSTUP_IO_THREADS: 1
# with:
# operating_system: freebsd
# version: '13.2'
# memory: 8G
# cpu_count: 3
# environment_variables: DEBUG RUSTUP_IO_THREADS
# shell: bash
# run: |
# sudo pkg install -y -f curl node libnghttp2 npm
# sudo npm install -g yarn --ignore-scripts
# curl https://sh.rustup.rs -sSf --output rustup.sh
# sh rustup.sh -y --profile minimal --default-toolchain stable
# source "$HOME/.cargo/env"
# cd ./bindings/node
# yarn install
# yarn build
# strip -x *.node
# mv ./decancer.freebsd-x64.node ../..
# rm -rf node_modules
# rm -rf target
# rm -rf .yarn/cache
# - name: Upload artifact
# if: ${{ needs.setup.outputs.release != 'null' }}
# uses: actions/upload-artifact@v4
# with:
# name: node-freebsd-x64
# path: decancer.freebsd-x64.node
# if-no-files-found: error
node-test:
name: Test node bindings
needs:
- setup
- node
if: ${{ always() && github.event_name != 'pull_request' && (needs.setup.outputs.release != 'null' || needs.setup.outputs.node_affected == 'true') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: latest
cache: yarn
- name: Install dependencies
working-directory: bindings/node
run: yarn install
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: node-x86_64-unknown-linux-gnu
path: bindings/node
- name: Test bindings
working-directory: bindings/node
run: yarn test
wasm:
name: Build and test wasm
runs-on: ubuntu-latest
needs:
- setup
- core
if: ${{ always() && (needs.setup.outputs.release != 'null' || needs.setup.outputs.wasm_affected == 'true') }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- uses: actions/setup-node@v4
with:
node-version: latest
- name: Setup wasm-pack
run: cargo install wasm-pack
- name: Build wasm
working-directory: bindings/wasm
run: |
wasm-pack build --no-typescript --release -t web
mv -f ./pkg/decancer_wasm_bg.wasm ./bin/decancer.wasm
cp ./bin/decancer.wasm ../..
- name: Test wasm
working-directory: bindings/wasm/tests
run: |
npm i
timeout 180 node .
- name: Upload artifact
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: wasm
path: decancer.wasm
if-no-files-found: error
commit:
name: Commit changes
runs-on: ubuntu-latest
needs:
- setup
- java
- wasm
if: ${{ always() && github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- uses: actions/setup-node@v4
with:
node-version: latest
- name: Setup clang
if: ${{ needs.setup.outputs.native_affected == 'true' || needs.setup.outputs.release != 'null' }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 18 all
shell: bash
- name: Prettier files
run: node scripts/pretty.mjs --clang-format=clang-format-18
env:
DECANCER_SETUP_OUTPUTS: ${{ toJSON(needs.setup.outputs) }}
shell: bash
- name: Update README files for bindings
run: |
node scripts/ci_readme.mjs ./core/README.md DECANCER_RUST
node scripts/ci_readme.mjs ./bindings/node/README.md DECANCER_JS
node scripts/ci_readme.mjs ./bindings/native/README.md DECANCER_NATIVE
shell: bash
- name: Download wasm artifact
if: ${{ needs.setup.outputs.wasm_affected == 'true' || needs.setup.outputs.release != 'null' }}
uses: actions/download-artifact@v4
with:
name: wasm
path: bindings/wasm/bin
- name: Download all java artifacts
if: ${{ needs.setup.outputs.java_affected == 'true' || needs.setup.outputs.release != 'null' }}
uses: actions/download-artifact@v4
with:
pattern: java-*
path: java-artifacts
- name: Modify bindings.zip
if: ${{ needs.setup.outputs.java_affected == 'true' || needs.setup.outputs.release != 'null' }}
run: |
node scripts/ci_validate_java_artifacts.mjs
mv ./java-artifacts/**/*.{dll,so,dylib} .
zip -FSr ./bindings/java/bin/bindings.zip ./*.{dll,so,dylib}
shell: bash
- name: Import Actions GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.CI_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.CI_GPG_PASS }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit
uses: EndBug/add-and-commit@v9
with:
commit: -S
message: 'chore: update files'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pages:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs:
- setup
- commit
permissions: write-all
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: ${{ always() && github.event_name != 'pull_request' && (needs.setup.outputs.release != 'null' || needs.setup.outputs.wasm_affected == 'true' || needs.setup.outputs.native_docs_affected == 'true') }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: latest
- uses: ssciwr/doxygen-install@v1
- name: Download wasm artifact
if: ${{ needs.setup.outputs.wasm_affected == 'true' || needs.setup.outputs.release != 'null' }}
uses: actions/download-artifact@v4
with:
name: wasm
path: bindings/wasm/bin
- name: Move wasm example file
run: mv ./bindings/wasm/example.html ./wasm_example.html
shell: bash
- name: Generate native library documentation
working-directory: bindings/native/docs
run: |
node ./docgen.mjs
mv ./html ../../../native_docs
shell: bash
- name: Setup GitHub Pages
uses: actions/configure-pages@v5
- name: Delete GitHub Pages deployment history
uses: strumwolf/delete-deployment-environment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: github-pages
onlyRemoveDeployments: true
- name: Prepare GitHub Pages directories
run: |
node ./scripts/ci_setup_pages.mjs
rm -rf ./scripts
shell: bash
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
java-publish:
name: Publish java binding
runs-on: ubuntu-latest
needs:
- setup
- commit
- java
if: ${{ always() && github.event_name != 'pull_request' && needs.setup.outputs.release != 'null' }}
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_NAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASS }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASS }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_VERSION: ${{ needs.setup.outputs.release }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 21
- name: Prepare java binding
working-directory: bindings/java
run: |
unzip ./bin/bindings.zip -d ./bin
chmod +x ./gradlew
./gradlew jreleaserConfig
./gradlew clean build publish -x test
shell: bash
- name: Publish java binding
working-directory: bindings/java
run: ./gradlew jreleaserFullRelease
continue-on-error: true
shell: bash
- name: Move jar file
working-directory: bindings/java
run: mv ./build/libs/decancer-${{ needs.setup.outputs.release }}.jar ../../decancer.jar
shell: bash
- name: Upload jar artifact
uses: actions/upload-artifact@v4
with:
name: java-jar
path: decancer.jar
if-no-files-found: error
publish:
name: Publish
runs-on: ubuntu-latest
needs:
- setup
- node-test
#- node-freebsd
- native-test
- commit
- pages
- java-publish
if: ${{ always() && github.event_name != 'pull_request' && needs.setup.outputs.release != 'null' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: latest
cache: yarn
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Modify artifacts
run: node scripts/ci_artifacts.mjs
- name: Install node dependencies
working-directory: bindings/node
run: yarn install
- name: Move node artifacts
working-directory: bindings/node
run: yarn artifacts
- name: Publish node binding
working-directory: bindings/node
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Import Actions GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.CI_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.CI_GPG_PASS }}
git_user_signingkey: true
git_tag_gpgsign: true
- name: Create GitHub Tag
uses: rickstaa/action-create-tag@v1
with:
message: "This is the GitHub Release for decancer v${{ needs.setup.outputs.release }}."
tag: "v${{ needs.setup.outputs.release }}"
gpg_private_key: ${{ secrets.CI_GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.CI_GPG_PASS }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body: "This is the GitHub Release for decancer v${{ needs.setup.outputs.release }}."
draft: false
prerelease: false
files: |
decancer.jar
*.zip
tag_name: "v${{ needs.setup.outputs.release }}"
token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_REPOSITORY: null8626/decancer