Add builds & dynamic loading for four targets #16
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: Build Rust Crate Shared Libraries | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
aarch64-apple-darwin: | |
runs-on: macos-latest | |
name: Build aarch64-apple-darwin target | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
run: rustup toolchain install stable | |
- name: Set Target | |
run: rustup target add aarch64-apple-darwin | |
- name: Build | |
run: RUSTFLAGS="-C link-arg=-static-libgcc -C link-arg=-static-libstdc++ -C link-arg=-mmacosx-version-min=10.7" cargo build --target aarch64-apple-darwin --release --package tbdex_uniffi | |
- name: Upload .dylib | |
uses: actions/upload-artifact@v3 | |
with: | |
name: aarch64-apple-darwin-dylib | |
path: target/aarch64-apple-darwin/release/libtbdex_uniffi.dylib | |
x86_64-apple-darwin: | |
runs-on: macos-latest | |
name: Build x86_64-apple-darwin target | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
run: rustup toolchain install stable | |
- name: Set Target | |
run: rustup target add x86_64-apple-darwin | |
- name: Build | |
run: RUSTFLAGS="-C link-arg=-static-libgcc -C link-arg=-static-libstdc++ -C link-arg=-mmacosx-version-min=10.7" cargo build --target x86_64-apple-darwin --release --package tbdex_uniffi | |
- name: Upload .dylib | |
uses: actions/upload-artifact@v3 | |
with: | |
name: x86_64-apple-darwin-dylib | |
path: target/x86_64-apple-darwin/release/libtbdex_uniffi.dylib | |
x86_64-unknown-linux-gnu: | |
runs-on: macos-latest | |
name: Build x86_64-unknown-linux-gnu target | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
run: rustup toolchain install stable | |
- name: Install Dependencies | |
run: | | |
brew tap messense/macos-cross-toolchains | |
brew install x86_64-unknown-linux-gnu | |
rustup target add x86_64-unknown-linux-gnu | |
- name: Build | |
run: | | |
export CC_x86_64_unknown_linux_gnu=x86_64-linux-gnu-gcc | |
export CXX_x86_64_unknown_linux_gnu=x86_64-linux-gnu-g++ | |
export AR_x86_64_unknown_linux_gnu=x86_64-linux-gnu-ar | |
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc | |
RUSTFLAGS="-C link-arg=-static-libgcc -C link-arg=-static-libstdc++" \ | |
cargo build --target x86_64-unknown-linux-gnu --release --package tbdex_uniffi | |
- name: Upload .so | |
uses: actions/upload-artifact@v3 | |
with: | |
name: x86_64-unknown-linux-gnu-so | |
path: target/x86_64-unknown-linux-gnu/release/libtbdex_uniffi.so | |
x86_64-unknown-linux-musl: | |
runs-on: macos-latest | |
name: Build x86_64-unknown-linux-musl target | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
run: rustup toolchain install stable | |
- name: Install Dependencies | |
run: | | |
brew tap messense/macos-cross-toolchains | |
brew install x86_64-unknown-linux-musl | |
rustup target add x86_64-unknown-linux-musl | |
- name: Build | |
run: | | |
export CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc | |
export CXX_x86_64_unknown_linux_musl=x86_64-linux-musl-g++ | |
export AR_x86_64_unknown_linux_musl=x86_64-linux-musl-ar | |
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-linux-musl-gcc | |
RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-static-libgcc -C link-arg=-static-libstdc++" \ | |
cargo build --target x86_64-unknown-linux-musl --release --package tbdex_uniffi | |
- name: Upload .so | |
uses: actions/upload-artifact@v3 | |
with: | |
name: x86_64-unknown-linux-musl-so | |
path: target/x86_64-unknown-linux-musl/release/libtbdex_uniffi.so |