Skip to content

Merge pull request #95 from evannetwork/feature/remove-payload-from-c… #375

Merge pull request #95 from evannetwork/feature/remove-payload-from-c…

Merge pull request #95 from evannetwork/feature/remove-payload-from-c… #375

Workflow file for this run

name: Build & Test - MacOS & Linux
on:
push:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
target:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
- x86_64-pc-windows-gnu
toolchain:
- stable
feature_target:
- target-c-sdk
- target-c-lib
- target-cli
- target-java-lib
- target-wasm
exclude:
# Don't test linux/windows targets on macos
- os: macos-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-pc-windows-gnu
# Don't test darwin/windows targets on ubuntu
- os: ubuntu-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-pc-windows-msvc
# Don't test darwin/linux targets on windows
- os: windows-latest
target: x86_64-pc-windows-gnu
- os: windows-latest
target: x86_64-apple-darwin
- os: windows-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
target: ${{ matrix.target }}
override: true
- run: rustup target add ${{ matrix.target }}
- name: Install clang for ubuntu
if: ${{ matrix.os == 'ubuntu-latest'}}
shell: bash
run: sudo apt install -y clang
- name: Install wasm-pack (with workaround for Linux)
# see https://github.com/rustwasm/wasm-pack/issues/781#issuecomment-1242611389
# and https://github.com/rustwasm/wasm-pack/issues/823#issuecomment-1242611318
if: ${{ matrix.os == 'ubuntu-latest' && matrix.feature_target == 'target-wasm'}}
run: cargo install --git https://github.com/frewsxcv/wasm-pack.git --branch patch-2
- name: Install wasm-pack (with official script)
if: ${{ matrix.os != 'ubuntu-latest' && matrix.feature_target == 'target-wasm'}}
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build WASM file with wasm-pack
if: ${{ matrix.feature_target == 'target-wasm' }}
run: wasm-pack build --release --target web -- --no-default-features --features=${{ matrix.feature_target }}
- name: install cross
run: cargo install -f cross
- name: native build
if: ${{ matrix.target != 'wasm32-unknown-unknown' && (matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'aarch64-apple-darwin' || matrix.target == 'x86_64-apple-darwin' || matrix.target == 'x86_64-pc-windows-msvc') }}
run: cargo build --release --no-default-features --features ${{ matrix.feature_target }} --target-dir=target/ --target=${{ matrix.target }}
- name: cross build
if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' && matrix.target != 'aarch64-apple-darwin' && matrix.target != 'x86_64-apple-darwin' && matrix.target != 'x86_64-pc-windows-msvc' && matrix.target != 'wasm32-unknown-unknown' }}
run: cross build --release --no-default-features --features ${{ matrix.feature_target }} --target-dir target/ --target ${{ matrix.target }}
- name: Run tests
if: ${{ matrix.feature_target != 'target-c-sdk' }}
run: cargo test --no-default-features --features=${{ matrix.feature_target }}