Skip to content

fix: try to fix wasm unreachable bug (attempt 28) #831

fix: try to fix wasm unreachable bug (attempt 28)

fix: try to fix wasm unreachable bug (attempt 28) #831

Workflow file for this run

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