diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c89b936 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: ci + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: "-Dwarnings" + CLASSPATH: "./jna-5.14.0.jar" + +jobs: + rust: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: "true" + - name: Build + run: cargo build + + - uses: swift-actions/setup-swift@v1 + - name: Download JNA + run: wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar + - name: Test + run: cargo test + + - name: Fmt + run: cargo fmt -- --check + - name: Clippy + run: cargo clippy + + kotlin: + runs-on: ubuntu-latest + needs: rust + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: "aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android" + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: "true" + + - uses: taiki-e/install-action@v2 + with: + tool: cargo-ndk + - uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Run tests + uses: gradle/gradle-build-action@v2 + with: + arguments: test + build-root-directory: ./kotlin + + swift: + runs-on: macos-latest + needs: rust + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: "aarch64-apple-ios-sim,aarch64-apple-ios,x86_64-apple-ios" + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: "true" + + - uses: taiki-e/install-action@v2 + with: + tool: cargo-swift + + - name: Generate Swift package + run: cargo swift package -p ios -n WalletSdkRs + - name: Fail if generated swift code needs update + run: git diff --exit-code WalletSdkRs/Sources/WalletSdkRs/wallet_sdk_rs.swift diff --git a/kotlin/walletsdkrs/src/test/java/com/spruceid/wallet/sdk/rs/ExampleUnitTest.kt b/kotlin/walletsdkrs/src/test/java/com/spruceid/wallet/sdk/rs/ExampleUnitTest.kt deleted file mode 100644 index c1163a1..0000000 --- a/kotlin/walletsdkrs/src/test/java/com/spruceid/wallet/sdk/rs/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.spruceid.wallet.sdk.rs - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class UniffiUnitTest { - @Test - fun uniffiFunction() { - assertEquals(helloFfi(), "Hello from Rust!") - } -} \ No newline at end of file