Skip to content

Commit

Permalink
Add CI (#2)
Browse files Browse the repository at this point in the history
Also remove native kotlin tests

They don't work as we only compile for android ABI and they're redundant
with the instrumented/android tests
  • Loading branch information
sbihel authored Jan 12, 2024
1 parent 77dddc2 commit 347a6a6
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 17 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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

This file was deleted.

0 comments on commit 347a6a6

Please sign in to comment.