Anoncreds #22
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: "Anoncreds" | |
env: | |
RUST_VERSION: "1.65.0" | |
CROSS_VERSION: "0.2.4" | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
inputs: | |
publish-binaries: | |
description: "Publish Binaries to Release (will create a release if no release exits for branch or tag)" | |
required: true | |
default: false | |
type: boolean | |
jobs: | |
build-release: | |
name: Build Library | |
strategy: | |
matrix: | |
include: | |
- architecture: linux-aarch64 | |
os: ubuntu-20.04 | |
target: aarch64-unknown-linux-gnu | |
lib: libanoncreds_uniffi.so | |
libPath: uniffi/target/aarch64-unknown-linux-gnu/release/libanoncreds_uniffi.so | |
use_cross: true | |
- architecture: linux-x86_64 | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
lib: libanoncreds_uniffi.so | |
libPath: uniffi/target/x86_64-unknown-linux-gnu/release/libanoncreds_uniffi.so | |
use_cross: true | |
- architecture: darwin-x86_64 | |
os: macos-latest | |
target: x86_64-apple-darwin | |
lib: libanoncreds_uniffi.dylib | |
libPath: uniffi/target/x86_64-apple-darwin/release/libanoncreds_uniffi.dylib | |
- architecture: darwin-aarch64 | |
os: macos-latest | |
target: aarch64-apple-darwin | |
lib: libanoncreds_uniffi.dylib | |
libPath: uniffi/target/aarch64-apple-darwin/release/libanoncreds_uniffi.dylib | |
- architecture: swift-package-universal | |
os: macos-latest | |
target: swift-package-universal | |
lib: libanoncreds.xcframework.zip | |
libPath: uniffi/output-frameworks/anoncreds-swift/libanoncreds.xcframework.zip | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust toolchain | |
if: "matrix.target != 'swift-package-universal'" | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
targets: ${{ matrix.target }} | |
- name: Cache cargo resources | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: deps | |
save-if: false | |
- name: Build library for Linux | |
if: "runner.os == 'Linux'" | |
run: | | |
cd uniffi | |
if [ -n "${{ matrix.use_cross }}" ]; then | |
cargo install --git https://github.com/cross-rs/cross --tag v${{ env.CROSS_VERSION }} cross | |
cross build --release --target ${{matrix.target}} | |
else | |
cargo build --release --target ${{matrix.target}} | |
fi | |
- name: Build library for macOS | |
if: "runner.os == 'macOS'" | |
run: | | |
cd uniffi | |
if [ "${{ matrix.architecture }}" == "swift-package-universal" ]; then | |
./build-release-apple-universal.sh | |
else | |
cargo build --release --target ${{matrix.target}} | |
fi | |
- name: Upload library artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.lib }} | |
path: ${{ matrix.libPath }} | |
- name: Create library artifacts directory | |
if: | | |
github.event_name == 'release' || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true') | |
run: | | |
mkdir release-artifacts | |
cp ${{ matrix.libPath }} release-artifacts/ | |
- name: Release artifacts | |
uses: a7ul/[email protected] | |
if: | | |
(${{ matrix.architecture }} != 'swift-package-universal' && | |
github.event_name == 'release' || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')) | |
with: | |
command: c | |
cwd: release-artifacts | |
files: . | |
outPath: "library-${{ matrix.architecture }}.tar.gz" | |
- name: Add library artifacts to release | |
if: | | |
(${{ matrix.architecture }} != 'swift-package-universal' && | |
github.event_name == 'release' || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')) | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: library-${{ matrix.architecture }}.tar.gz | |
asset_name: "library-${{ matrix.architecture }}-${{ github.sha }}.tar.gz" | |
- name: Add swift package artifacts to release | |
if: | | |
(${{ matrix.architecture }} == 'swift-package-universal' && | |
github.event_name == 'release' || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')) | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: ${{ matrix.lib }} | |
asset_name: "${{ matrix.lib }}" |