feat: release automation for swift & kotlin #617
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
IROH_FORCE_STAGING_RELAYS: "1" | |
jobs: | |
build_and_test_rust: | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 30 | |
name: Rust - Build and test | |
strategy: | |
fail-fast: false | |
matrix: | |
name: [ubuntu-latest, macOS-arm-latest, windows-latest] | |
rust: [stable] | |
include: | |
- name: ubuntu-latest | |
os: ubuntu-latest | |
release-os: linux | |
release-arch: amd64 | |
runner: [linux, X64] | |
- name: macOS-arm-latest | |
os: macOS-latest | |
release-os: darwin | |
release-arch: aarch64 | |
runner: [macOS, ARM64] | |
- name: windows-latest | |
os: windows | |
runner: [windows-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
submodules: recursive | |
- name: Install ${{ matrix.rust }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: cargo test | |
run: cargo test | |
check_fmt_and_docs: | |
timeout-minutes: 30 | |
name: Checking fmt and docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: fmt | |
run: cargo fmt -- --check | |
- name: Docs | |
run: cargo doc --all-features --no-deps --document-private-items | |
clippy_check: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: clippy check | |
run: cargo clippy --all-targets --bins --tests --benches | |
build_and_test_python: | |
name: Python - Build and test | |
timeout-minutes: 30 | |
runs-on: [linux, x64] | |
steps: | |
- uses: actions/checkout@master | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install virtualenv | |
run: pip install virtualenv | |
- name: Python tests | |
run: | | |
virtualenv venv | |
source venv/bin/activate | |
pip install setuptools pytest pytest-asyncio "maturin[patchelf]" uniffi-bindgen | |
maturin develop | |
pytest -v | |
build_and_test_swift: | |
name: Swift - Build and test | |
timeout-minutes: 30 | |
runs-on: [macOS, ARM64] | |
steps: | |
- uses: actions/checkout@master | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-ios,aarch64-apple-darwin | |
- name: Swift tests | |
run: | | |
./make_swift.sh | |
cp -R Iroh.xcframework IrohLib/artifacts/ | |
cd IrohLib | |
swift test | |
build_and_test_kotlin: | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 30 | |
name: Kotlin - Build and test | |
strategy: | |
fail-fast: false | |
matrix: | |
name: [ubuntu-latest, macOS-arm-latest] | |
rust: [stable] | |
include: | |
- name: ubuntu-latest | |
os: linux | |
release-os: linux | |
release-arch: amd64 | |
runner: [linux, X64] | |
- name: macOS-arm-latest | |
os: mac | |
release-os: darwin | |
release-arch: aarch64 | |
runner: [macOS, ARM64] | |
# - name: windows-latest | |
# os: windows | |
# runner: [windows-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
submodules: recursive | |
- name: Install ${{ matrix.rust }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '21' | |
- name: install kotlin | |
uses: arqu/setup-kotlin@main | |
- name: install ktlint | |
uses: arqu/action-ktlint-setup@main | |
- name: fetch jna | |
run: curl -L https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar -o jna.jar | |
- name: fetch kotlinx-coroutines | |
run: curl -L https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.4/kotlinx-coroutines-core-jvm-1.6.4.jar -o kotlinx-coroutines.jar | |
- name: run kotlin tests | |
env: | |
CLASSPATH: ./jna.jar:./kotlinx-coroutines.jar | |
TEST_OS: ${{ matrix.os }} | |
shell: bash | |
run: ./test_kotlin.sh | |
build-and-publish-kotlin-test: | |
name: Build & publish kotlin libraries | |
timeout-minutes: 30 | |
runs-on: [self-hosted, linux, X64] | |
steps: | |
- uses: actions/checkout@master | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android | |
- name: setup java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '21' | |
- name: install kotlin | |
uses: arqu/setup-kotlin@main | |
- name: install ktlint | |
uses: arqu/action-ktlint-setup@main | |
- name: fetch jna | |
run: curl -L https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar -o jna.jar | |
- name: fetch kotlinx-coroutines | |
run: curl -L https://repo1.maven.org/maven2/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.4/kotlinx-coroutines-core-jvm-1.6.4.jar -o kotlinx-coroutines.jar | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Setup Android NDK | |
uses: arqu/setup-ndk@main | |
id: setup-ndk | |
with: | |
ndk-version: r23 | |
add-to-path: true | |
- name: Build kotlin | |
shell: bash | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
CLASSPATH: ./jna.jar:./kotlinx-coroutines.jar | |
run: | | |
cargo install --version 3.5.4 cargo-ndk | |
cargo build --lib | |
cargo ndk -o ./kotlin \ | |
--manifest-path ./Cargo.toml \ | |
-t armeabi-v7a \ | |
-t arm64-v8a \ | |
-t x86 \ | |
-t x86_64 \ | |
build --release | |
cargo run --bin uniffi-bindgen generate --language kotlin --library ./target/debug/libiroh_ffi.so --out-dir ./kotlin --config uniffi.toml | |
kotlinc -Werror -d ./kotlin/iroh.jar ./kotlin/iroh/*.kt |