This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate workflow to run-on macos-latest
- Loading branch information
1 parent
7ed41b6
commit d2aad1a
Showing
1 changed file
with
46 additions
and
49 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,96 @@ | ||
name: Build Rust Crate Shared Libraries | ||
name: Build Rust Crate for macOS and Linux | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- kendall/build-both-macs_static-linking | ||
pull_request: | ||
|
||
jobs: | ||
build-intel: | ||
runs-on: macos-13 | ||
name: Build on Intel (x86) macOS | ||
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 x86_64-apple-darwin | ||
run: rustup target add aarch64-apple-darwin | ||
- name: Build | ||
run: cargo build --target x86_64-apple-darwin -p tbdex_uniffi --release | ||
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: intel-build-dylib | ||
path: target/x86_64-apple-darwin/release/libtbdex_uniffi.dylib | ||
name: apple-silicon-build-dylib | ||
path: target/release/libtbdex_uniffi.dylib | ||
|
||
build-apple-silicon: | ||
x86_64-apple-darwin: | ||
runs-on: macos-latest | ||
name: Build on Apple Silicon (ARM) macOS | ||
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: cargo build -p tbdex_uniffi --release | ||
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: apple-silicon-build-dylib | ||
path: target/release/libtbdex_uniffi.dylib | ||
name: intel-build-dylib | ||
path: target/x86_64-apple-darwin/release/libtbdex_uniffi.dylib | ||
|
||
build-ubuntu: | ||
runs-on: ubuntu-latest | ||
name: Build on Ubuntu (AMD64) | ||
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: Set Target | ||
run: rustup target add x86_64-unknown-linux-gnu | ||
- name: Install Dependencies | ||
run: sudo apt-get update && sudo apt-get install -y build-essential | ||
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: cargo build --target x86_64-unknown-linux-gnu -p tbdex_uniffi --release | ||
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: ubuntu-build-so | ||
path: target/x86_64-unknown-linux-gnu/release/libtbdex_uniffi.so | ||
|
||
build-alpine: | ||
runs-on: ubuntu-latest | ||
name: Build on Alpine (AMD64) | ||
container: alpine:latest | ||
x86_64-unknown-linux-musl: | ||
runs-on: macos-latest | ||
name: Build x86_64-unknown-linux-musl target | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Dependencies | ||
run: | | ||
apk add --no-cache \ | ||
build-base \ | ||
cmake \ | ||
pkgconfig \ | ||
openssl-dev \ | ||
curl \ | ||
wget \ | ||
git \ | ||
ca-certificates \ | ||
linux-headers \ | ||
perl \ | ||
coreutils | ||
- name: Install Rust | ||
run: rustup toolchain install stable | ||
- name: Install Dependencies | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
export PATH="$HOME/.cargo/bin:$PATH" | ||
rustup default 1.78.0 | ||
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 PATH="$HOME/.cargo/bin:$PATH" | ||
export OPENSSL_DIR=/usr | ||
export OPENSSL_LIB_DIR=/usr/lib | ||
export OPENSSL_INCLUDE_DIR=/usr/include | ||
export PKG_CONFIG_PATH=/usr/lib/pkgconfig | ||
RUSTFLAGS="-C target-feature=-crt-static" cargo build --release --target x86_64-unknown-linux-musl -p tbdex_uniffi | ||
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: alpine-build-so | ||
name: ubuntu-build-so | ||
path: target/x86_64-unknown-linux-musl/release/libtbdex_uniffi.so |