Skip to content

V2 ecies library (#260) #535

V2 ecies library (#260)

V2 ecies library (#260) #535

Workflow file for this run

name: Build
on:
pull_request:
push:
branches:
- main
- v2
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [
x86_64-linux-android,
i686-linux-android,
armv7-linux-androideabi,
aarch64-linux-android,
]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: "Cache"
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./target/${{ matrix.target }}
key: ${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
# Install latest cross to mitigate unwind linking issue on android builds.
# See https://github.com/cross-rs/cross/issues/1222
- name: Install rust cross
run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }} --manifest-path xmtp_dh/Cargo.toml --target-dir xmtp_dh/target
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: xmtp_dh/target/${{ matrix.target }}/release/libxmtp_dh.so
retention-days: 1
build-macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
target: [
aarch64-apple-darwin,
x86_64-apple-darwin,
aarch64-apple-ios,
x86_64-apple-ios,
aarch64-apple-ios-sim,
]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: "Cache"
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./target/${{ matrix.target }}
key: ${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build target
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }} --manifest-path bindings_swift/Cargo.toml --target-dir bindings_swift/target
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: bindings_swift/target/${{ matrix.target }}/release/libxmtp_rust_swift.a
retention-days: 1
kotlin:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./target/release
key: ${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-apple-darwin
- name : Install kotlin
run: brew install ktlint
- name: Generate Bindings
working-directory: xmtp_dh
run: ./gen_kotlin.sh
- name: Upload xmtp_dh.kt
uses: actions/upload-artifact@v3
with:
name: kotlin
path: xmtp_dh/src/uniffi/xmtp_dh/xmtp_dh.kt
retention-days: 1
swift:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./target/release
key: ${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-apple-darwin
- name : Install swift
run: brew install swiftformat
- name: Generate and package bindings
working-directory: bindings_swift
run: make bridge
- name: Upload binding archive
uses: actions/upload-artifact@v3
with:
name: bridge
path: |
bindings_swift/include
bindings_swift/Sources
retention-days: 1
package-swift:
needs: [ build-macos, swift ]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Download libs
uses: actions/download-artifact@v3
with:
path: bindings_swift/build
- name: Build xmtp-rust-swift.zip
working-directory: bindings_swift
run: |
rm -r ./include
mv build/bridge/include .
mv build/bridge/Sources .
make swift
- name: Upload xmtp-rust-swift.zip
uses: actions/upload-artifact@v3
with:
name: xmtp-rust-swift.zip
path: bindings_swift/xmtp-rust-swift.zip
retention-days: 1
package-android:
needs: [ build, kotlin ]
runs-on: ubuntu-latest
steps:
- name: Download libs & bindings
uses: actions/download-artifact@v3
with:
path: .
- name: Build xmtp_dh.zip
run: |
# not sure why we're building this one
# mv aarch64-unknown-linux-gnu/libxmtp_dh.so jniLibs/arm64-v8a/
# mkdir -p jniLibs/x86_64
# mv x86_64-linux-android/libxmtp_dh.so jniLibs/x86_64/
mkdir -p jniLibs/x86
mv i686-linux-android/libxmtp_dh.so jniLibs/x86/
mkdir -p jniLibs/armeabi-v7a
mv armv7-linux-androideabi/libxmtp_dh.so jniLibs/armeabi-v7a/
mkdir -p jniLibs/arm64-v8a
mv aarch64-linux-android/libxmtp_dh.so jniLibs/arm64-v8a/
mkdir -p java
mv kotlin/xmtp_dh.kt java/
zip -r xmtp_dh.zip jniLibs java
- name: Upload xmtp_dh.zip
uses: actions/upload-artifact@v3
with:
name: xmtp_dh.zip
path: xmtp_dh.zip