Refactoring and improved CI w/ cross compiling #2
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- released | |
- prereleased | |
jobs: | |
test-cross: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- x86_64-unknown-linux-musl | |
- s390x-unknown-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross --rev 6d097fb | |
- name: Test | |
run: cross test --target ${{ matrix.target }} --release | |
test-wasm32-emscripten: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
build: [static, shared] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: wasm32-unknown-emscripten | |
- name: Install Emscripten | |
uses: mymindstorm/setup-emsdk@v14 | |
- name: Build | |
run: cargo build --target wasm32-unknown-emscripten --no-default-features --features ${{ matrix.build }} | |
test-native: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-13 # x86_64 | |
- macos-14 # M1 | |
- windows-latest | |
- ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install build dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: sudo apt install nasm | |
- name: Install build dependencies (Macos) | |
run: brew install nasm | |
if: runner.os == 'macOS' | |
- name: Set MSVC developer prompt | |
if: runner.os == 'Windows' | |
uses: ilammy/[email protected] | |
- name: Install nasm (Windows) | |
if: runner.os == 'Windows' | |
uses: ilammy/[email protected] | |
- name: Test (shared) | |
run: cargo test --features shared --lib --release | |
- name: Test (static) | |
run: | | |
cargo clean # ensure we're starting fresh, no funny business | |
cargo test --no-default-features --features static --release | |
- name: Run examples | |
shell: bash | |
run: | | |
for example in $(find examples -name '*.rs'); do | |
example_name=$(basename $example .rs) | |
echo "------- Running example: ${example_name} -------" | |
cargo run --example $example_name | |
done |