v1.2.0 #3
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: Native prebuilt publish | |
on: | |
release: | |
types: [published] | |
env: | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
native-binding-prebuilt: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-13, ubuntu-20.04, windows-2022] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
- name: Select Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
if: matrix.os == 'macos-13' | |
with: | |
xcode-version: '14.3' | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install LLVM and Clang (Windows) # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 | |
uses: KyleMayes/install-llvm-action@32c4866ebb71e0949e8833eb49beeebed48532bd | |
if: matrix.os == 'windows-2022' | |
with: | |
version: "11.0" | |
directory: ${{ runner.temp }}/llvm | |
- name: Set LIBCLANG_PATH (Windows) | |
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV | |
if: matrix.os == 'windows-2022' | |
- name: Set deployment target (macOS) | |
run: echo "MACOSX_DEPLOYMENT_TARGET=10.14" >> $GITHUB_ENV | |
if: matrix.os == 'macos-13' | |
- name: Get current date | |
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
if: matrix.os == 'macos-13' || ${{ startsWith(matrix.os, 'ubuntu') }} | |
- name: Get current date | |
if: matrix.os == 'windows-2022' | |
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Install required packages (Ubuntu) | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install libudev-dev libusb-1.0-0-dev | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
# Add date to the cache to keep it up to date | |
key: ${{ matrix.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ env.CURRENT_DATE }} | |
# Restore from outdated cache for speed | |
restore-keys: | | |
${{ matrix.os }}-stable-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
${{ matrix.os }}-stable-cargo-registry- | |
- name: Cache cargo index | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/git | |
# Add date to the cache to keep it up to date | |
key: ${{ matrix.os }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }}-${{ env.CURRENT_DATE }} | |
# Restore from outdated cache for speed | |
restore-keys: | | |
${{ matrix.os }}-stable-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
${{ matrix.os }}-stable-cargo-index- | |
# This step is required to support macOS 10.13 | |
- name: Patch librocksdb-sys (macOS) | |
if: matrix.os == 'macos-latest123' | |
run: | | |
cargo install cargo-patch | |
cp ${{ github.workspace }}/.patches/rocksdb_faligned_allocation.patch . | |
git apply --ignore-space-change --ignore-whitespace ${{ github.workspace }}/.patches/macos_cargo_toml.patch | |
cat Cargo.toml | |
cargo patch | |
- name: Cargo build | |
run: cargo build --release | |
- name: Upload package to Github release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
target/release/libiota_sdk.so | |
target/release/iota_sdk.dll | |
target/release/libiota_sdk.dylib | |
fail_on_unmatched_files: false | |
tag_name: ${{ steps.prepare_release.outputs.tag_name }} |