Skip to content

Use Epoch From events in Proposal Task #2963

Use Epoch From events in Proposal Task

Use Epoch From events in Proposal Task #2963

name: Build Crypto Helper Library
on:
push:
branches:
- main
tags:
- "sdks/go/v*.*.*"
pull_request:
workflow_dispatch:
env:
CARGO_INCREMENTAL: "0"
jobs:
build:
name: Build Crypto Helper Library
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-apple-darwin
runner: macos-latest
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.81.0"
targets: ${{ matrix.target }}
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Set Environment
# Install tools and set environment variables like this example
# https://github.com/briansmith/ring/blob/main/mk/cargo.sh
# https://github.com/briansmith/ring/blob/main/mk/install-build-tools.sh
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: |
sudo apt update
sudo apt-get install qemu-user gcc-aarch64-linux-gnu libc6-dev-arm64-cross
echo CFLAGS_aarch64_unknown_linux_gnu="--sysroot=/usr/aarch64-linux-gnu" >> ${{ github.env }}
echo CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc >> ${{ github.env }}
echo CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" >> ${{ github.env }}
- name: Build
run: |
echo "Building for target: ${{ matrix.target }}"
if [ "$(uname -s)" != "Darwin" ]; then
export LD_LIBRARY_PATH="$PWD/target/lib:$LD_LIBRARY_PATH"
fi
mkdir -p target/lib && \
cargo build --release --locked --target ${{ matrix.target }} --manifest-path ./sdks/crypto-helper/Cargo.toml && \
if [ "$(uname -s)" == "Darwin" ]; then
cp ./target/${{ matrix.target }}/release/libespresso_crypto_helper.dylib target/lib/libespresso_crypto_helper-${{ matrix.target }}.dylib
shasum -a 256 target/lib/libespresso_crypto_helper-${{ matrix.target }}.dylib | awk '{print $1}' > target/lib/libespresso_crypto_helper-${{ matrix.target }}.dylib.sha256
else
cp ./target/${{ matrix.target }}/release/libespresso_crypto_helper.so target/lib/libespresso_crypto_helper-${{ matrix.target }}.so
shasum -a 256 target/lib/libespresso_crypto_helper-${{ matrix.target }}.so | awk '{print $1}' > target/lib/libespresso_crypto_helper-${{ matrix.target }}.so.sha256
fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: libespresso_crypto_helper-${{ matrix.target }}.${{ contains(matrix.target, 'apple-darwin') && 'dylib' || 'so' }}
path: |
target/lib/libespresso_crypto_helper-${{ matrix.target }}.${{ contains(matrix.target, 'apple-darwin') && 'dylib' || 'so' }}
- name: Upload sha256 files
uses: actions/upload-artifact@v4
with:
name: libespresso_crypto_helper-${{ matrix.target }}.${{ contains(matrix.target, 'apple-darwin') && 'dylib' || 'so' }}.sha256
path: |
target/lib/libespresso_crypto_helper-${{ matrix.target }}.${{ contains(matrix.target, 'apple-darwin') && 'dylib' || 'so' }}.sha256
release:
name: Upload Release Artifacts
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all Artifacts
uses: actions/download-artifact@v4
with:
path: target/lib
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/lib/*/*.dylib
target/lib/*/*.so
target/lib/*/*.dylib.sha256
target/lib/*/*.so.sha256