mirror of
https://github.com/gorules/zen.git
synced 2026-12-04 08:09:17 +00:00
chore: merge master into release/2.2
This commit is contained in:
@@ -20,7 +20,9 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
run: |
|
||||
rustup toolchain install 1.99.0 --profile minimal
|
||||
rustup default 1.99.0
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
shared-key: benchmark-rust
|
||||
@@ -48,9 +50,9 @@ jobs:
|
||||
cache: yarn
|
||||
cache-dependency-path: 'bindings/nodejs/yarn.lock'
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
with:
|
||||
toolchain: stable
|
||||
toolchain: 1.99.0
|
||||
targets: x86_64-unknown-linux-gnu
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
@@ -75,7 +77,9 @@ jobs:
|
||||
with:
|
||||
python-version: '3.13'
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
run: |
|
||||
rustup toolchain install 1.99.0 --profile minimal
|
||||
rustup default 1.99.0
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
shared-key: benchmark-python
|
||||
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
toolchain: 1.99.0
|
||||
override: true
|
||||
target: ${{ matrix.settings.target }}
|
||||
- uses: ./.github/actions/setup-rust
|
||||
|
||||
@@ -31,7 +31,6 @@ jobs:
|
||||
settings:
|
||||
- host: windows-latest
|
||||
target: 'x86_64-pc-windows-msvc'
|
||||
toolchain: '1.99'
|
||||
build: |
|
||||
yarn build -- --target x86_64-pc-windows-msvc -- --locked
|
||||
|
||||
@@ -123,9 +122,9 @@ jobs:
|
||||
cache-dependency-path: 'bindings/nodejs/yarn.lock'
|
||||
|
||||
- name: Install
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
with:
|
||||
toolchain: ${{ matrix.settings.toolchain || 'stable' }}
|
||||
toolchain: 1.99.0
|
||||
targets: ${{ matrix.settings.target }}
|
||||
|
||||
- name: Rust cache + sccache (+ zig for linux legs)
|
||||
@@ -162,6 +161,14 @@ jobs:
|
||||
path: bindings/nodejs/index.d.ts
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload JS binding
|
||||
if: ${{ matrix.settings.target == 'wasm32-wasip1' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: js-binding
|
||||
path: bindings/nodejs/index.js
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload artifact ${{ matrix.settings.target }}
|
||||
if: ${{ matrix.settings.target != 'wasm32-wasip1' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -255,6 +262,12 @@ jobs:
|
||||
name: typings
|
||||
path: bindings/nodejs
|
||||
|
||||
- name: Download JS binding
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: js-binding
|
||||
path: bindings/nodejs
|
||||
|
||||
- name: Test bindings (native)
|
||||
if: ${{ !matrix.settings.image }}
|
||||
run: |
|
||||
@@ -308,6 +321,12 @@ jobs:
|
||||
name: typings
|
||||
path: bindings/nodejs
|
||||
|
||||
- name: Download JS binding
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: js-binding
|
||||
path: bindings/nodejs
|
||||
|
||||
- name: Test bindings (wasm)
|
||||
run: yarn test:wasm
|
||||
|
||||
@@ -352,6 +371,12 @@ jobs:
|
||||
name: typings
|
||||
path: bindings/nodejs
|
||||
|
||||
- name: Download JS binding
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: js-binding
|
||||
path: bindings/nodejs
|
||||
|
||||
- name: List all artifacts
|
||||
run: ls -la ../../artifacts
|
||||
|
||||
@@ -369,6 +394,17 @@ jobs:
|
||||
run: ls ./
|
||||
shell: bash
|
||||
|
||||
- name: Verify JS binding version
|
||||
run: |
|
||||
version=$(node -p "require('./package.json').version")
|
||||
stale=$(grep -o "bindingPackageVersion !== '[^']*'" index.js | grep -v "'$version'" || true)
|
||||
if [ -n "$stale" ] || ! grep -q "bindingPackageVersion !== '$version'" index.js; then
|
||||
echo "index.js does not check for version $version:"
|
||||
echo "$stale" | sort | uniq -c
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Lerna publish
|
||||
run: yarn lerna publish from-package --dist-tag ${{ contains(github.ref, '-beta') && 'beta' || 'latest' }} --no-verify-access --yes
|
||||
env:
|
||||
|
||||
@@ -62,6 +62,7 @@ jobs:
|
||||
args: ${{ matrix.args }}
|
||||
manylinux: ${{ matrix.manylinux || 'auto' }}
|
||||
sccache: 'true'
|
||||
rust-toolchain: 1.99.0
|
||||
|
||||
- name: Upload wheels
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
ref: ${{ steps.release.outputs.pr-branch }}
|
||||
token: ${{ secrets.PAT }}
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/rust-toolchain@1.99.0
|
||||
if: steps.release.outputs.pr-branch
|
||||
|
||||
- name: Update Cargo.lock on release PR
|
||||
|
||||
@@ -48,7 +48,9 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
run: |
|
||||
rustup toolchain install 1.99.0 --profile minimal
|
||||
rustup default 1.99.0
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
shared-key: rust-test-${{ matrix.os }}-${{ matrix.features.key }}
|
||||
@@ -65,7 +67,9 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
run: |
|
||||
rustup toolchain install 1.99.0 --profile minimal --component rustfmt
|
||||
rustup default 1.99.0
|
||||
- run: cargo fmt --all -- --check
|
||||
|
||||
release:
|
||||
@@ -80,7 +84,9 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install Rust
|
||||
run: rustup update stable
|
||||
run: |
|
||||
rustup toolchain install 1.99.0 --profile minimal
|
||||
rustup default 1.99.0
|
||||
|
||||
- name: Login to Crates.IO
|
||||
run: cargo login ${{ secrets.CRATES_TOKEN }}
|
||||
|
||||
+101
-15
@@ -20,6 +20,8 @@ jobs:
|
||||
id-token: write
|
||||
env:
|
||||
OUTPUT_NAME: zen_uniffi
|
||||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: '-C target-feature=-crt-static'
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS: '-C target-feature=-crt-static'
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
@@ -27,7 +29,6 @@ jobs:
|
||||
settings:
|
||||
- host: windows-latest
|
||||
target: 'x86_64-pc-windows-msvc'
|
||||
toolchain: '1.99'
|
||||
output: '{0}.dll'
|
||||
lib_dir: 'win32-x86-64'
|
||||
- host: macos-latest
|
||||
@@ -46,6 +47,14 @@ jobs:
|
||||
target: 'aarch64-unknown-linux-gnu'
|
||||
output: 'lib{0}.so'
|
||||
lib_dir: 'linux-aarch64'
|
||||
- host: ubuntu-latest
|
||||
target: 'x86_64-unknown-linux-musl'
|
||||
output: 'lib{0}.so'
|
||||
lib_dir: 'linux-musl-x86-64'
|
||||
- host: ubuntu-latest
|
||||
target: 'aarch64-unknown-linux-musl'
|
||||
output: 'lib{0}.so'
|
||||
lib_dir: 'linux-musl-aarch64'
|
||||
- host: ubuntu-latest
|
||||
target: 's390x-unknown-linux-gnu'
|
||||
output: 'lib{0}.so'
|
||||
@@ -59,9 +68,8 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
with:
|
||||
toolchain: ${{ matrix.settings.toolchain || 'stable' }}
|
||||
target: ${{ matrix.settings.target }}
|
||||
|
||||
- uses: ./.github/actions/setup-rust
|
||||
@@ -76,18 +84,24 @@ jobs:
|
||||
- name: Build (zig, linux)
|
||||
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
|
||||
working-directory: ${{ env.UNIFFI_DIRECTORY }}
|
||||
run: cargo zigbuild --lib --release --locked --target ${{ matrix.settings.target }}.${{ env.GLIBC_VERSION }} ${{ matrix.settings.extra_args }}
|
||||
run: |
|
||||
TARGET="${{ matrix.settings.target }}"
|
||||
case "$TARGET" in
|
||||
*-musl) ZIG_TARGET="$TARGET" ;;
|
||||
*) ZIG_TARGET="$TARGET.$GLIBC_VERSION" ;;
|
||||
esac
|
||||
cargo zigbuild --lib --release --locked --target "$ZIG_TARGET" ${{ matrix.settings.extra_args }}
|
||||
- name: Build (native)
|
||||
if: ${{ matrix.settings.host != 'ubuntu-latest' }}
|
||||
uses: houseabsolute/actions-rust-cross@v1
|
||||
with:
|
||||
working-directory: ${{ env.UNIFFI_DIRECTORY }}
|
||||
target: ${{ matrix.settings.target }}
|
||||
toolchain: ${{ matrix.settings.toolchain || 'stable' }}
|
||||
toolchain: 1.99.0
|
||||
args: '--lib --release --locked ${{ matrix.settings.extra_args }}'
|
||||
|
||||
- name: Verify max glibc requirement
|
||||
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
|
||||
if: ${{ matrix.settings.host == 'ubuntu-latest' && !endsWith(matrix.settings.target, '-musl') }}
|
||||
run: |
|
||||
LIB="target/${{ matrix.settings.target }}/release/lib${{ env.OUTPUT_NAME }}.so"
|
||||
MAX=$(grep -aoE 'GLIBC_2\.[0-9]+(\.[0-9]+)?' "$LIB" | sort -uV | tail -1)
|
||||
@@ -98,6 +112,16 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Verify musl library links libc dynamically
|
||||
if: ${{ endsWith(matrix.settings.target, '-musl') }}
|
||||
run: |
|
||||
LIB="target/${{ matrix.settings.target }}/release/lib${{ env.OUTPUT_NAME }}.so"
|
||||
readelf -d "$LIB" | grep NEEDED
|
||||
if ! readelf -d "$LIB" | grep -q 'NEEDED.*libc\.so'; then
|
||||
echo "::error::$LIB does not link libc dynamically"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -133,7 +157,7 @@ jobs:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
@@ -188,6 +212,68 @@ jobs:
|
||||
- name: Run C# tests
|
||||
run: dotnet test tests/csharp
|
||||
|
||||
test-musl:
|
||||
name: Test musl (Java, Kotlin, C#) - ${{ matrix.settings.lib_dir }}
|
||||
needs: [ build ]
|
||||
runs-on: ${{ matrix.settings.host }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
settings:
|
||||
- host: ubuntu-latest
|
||||
lib_dir: 'linux-musl-x86-64'
|
||||
- host: ubuntu-24.04-arm
|
||||
lib_dir: 'linux-musl-aarch64'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ env.UNIFFI_DIRECTORY }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
shared-key: uniffi-test-musl-${{ matrix.settings.lib_dir }}
|
||||
sccache-bucket: ${{ secrets.SCCACHE_S3_BUCKET }}
|
||||
sccache-region: ${{ secrets.SCCACHE_AWS_REGION }}
|
||||
sccache-role-arn: ${{ secrets.SCCACHE_AWS_ROLE_ARN }}
|
||||
|
||||
- name: Download musl native library
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.settings.lib_dir }}
|
||||
path: ${{ env.UNIFFI_DIRECTORY }}/build/generated/resources/${{ matrix.settings.lib_dir }}
|
||||
|
||||
- name: Install uniffi-bindgen-java
|
||||
run: cargo install uniffi-bindgen-java --version 0.4.2 --locked
|
||||
|
||||
- name: Install uniffi-bindgen-cs
|
||||
run: cargo install uniffi-bindgen-cs --git https://github.com/gorules/uniffi-bindgen-cs --rev d080b41
|
||||
|
||||
- name: Build unstripped host library for binding generation
|
||||
env:
|
||||
CARGO_PROFILE_RELEASE_STRIP: 'none'
|
||||
run: cargo build --lib --release --locked
|
||||
|
||||
- name: Generate Java, Kotlin and C# sources
|
||||
run: |
|
||||
LIB=../../target/release/libzen_uniffi.so
|
||||
uniffi-bindgen-java generate --out-dir build/generated/java "$LIB"
|
||||
cargo run --locked --bin uniffi-bindgen -- generate --library "$LIB" --language kotlin --out-dir build/generated/kotlin
|
||||
uniffi-bindgen-cs --library "$LIB" --config uniffi.toml --out-dir build/generated/csharp
|
||||
|
||||
- name: Run Java and Kotlin tests (Alpine)
|
||||
run: docker run --rm -v "$GITHUB_WORKSPACE:/work" -w /work/${{ env.UNIFFI_DIRECTORY }} eclipse-temurin:23-jdk-alpine ./gradlew testJava testKotlin --no-daemon
|
||||
|
||||
- name: Run C# tests (Alpine)
|
||||
run: docker run --rm -v "$GITHUB_WORKSPACE:/work" -w /work/${{ env.UNIFFI_DIRECTORY }} mcr.microsoft.com/dotnet/sdk:8.0-alpine dotnet test tests/csharp
|
||||
|
||||
test-swift:
|
||||
name: Test (Swift)
|
||||
runs-on: macos-latest
|
||||
@@ -202,7 +288,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
@@ -232,7 +318,7 @@ jobs:
|
||||
release-java-kotlin:
|
||||
runs-on: ubuntu-latest
|
||||
environment: release
|
||||
needs: [ build, test-jvm-dotnet ]
|
||||
needs: [ build, test-jvm-dotnet, test-musl ]
|
||||
if: "github.ref_type == 'tag'"
|
||||
defaults:
|
||||
run:
|
||||
@@ -247,7 +333,7 @@ jobs:
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
@@ -306,7 +392,7 @@ jobs:
|
||||
release-csharp:
|
||||
runs-on: ubuntu-latest
|
||||
environment: release
|
||||
needs: [ build, test-jvm-dotnet ]
|
||||
needs: [ build, test-jvm-dotnet, test-musl ]
|
||||
permissions:
|
||||
id-token: write # Required for OIDC
|
||||
if: "github.ref_type == 'tag'"
|
||||
@@ -323,7 +409,7 @@ jobs:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
@@ -416,7 +502,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
with:
|
||||
target: ${{ matrix.settings.target }}
|
||||
|
||||
@@ -452,7 +538,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
@@ -632,7 +718,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Rust Toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
uses: dtolnay/rust-toolchain@1.99.0
|
||||
|
||||
- uses: ./.github/actions/setup-rust
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user