Skip to content

ci: github actions workflows for test + release, badges, expanded usa… #1

ci: github actions workflows for test + release, badges, expanded usa…

ci: github actions workflows for test + release, badges, expanded usa… #1

Workflow file for this run

name: CI
on:
push:
branches: [master, main]
paths:
- '**/*.rs'
- '**/Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'rust-toolchain'
- '.github/workflows/ci.yml'
pull_request:
branches: [master, main]
paths:
- '**/*.rs'
- '**/Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'rust-toolchain'
- '.github/workflows/ci.yml'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short
jobs:
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux (x86_64)
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: Linux (aarch64)
os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
- name: macOS (x86_64)
os: macos-13
target: x86_64-apple-darwin
- name: macOS (aarch64)
os: macos-latest
target: aarch64-apple-darwin
- name: Windows (x86_64)
os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.target }}
- name: Install cmake (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential pkg-config
- name: Install cmake (macOS)
if: runner.os == 'macOS'
run: |
brew install cmake || true
# Windows runners come with cmake + MSVC build tools preinstalled.
- name: Build (default features)
run: cargo build --workspace --all-targets --target ${{ matrix.target }}
- name: Test (default features)
run: cargo test --workspace --target ${{ matrix.target }}
- name: Build (--features unicorn)
run: cargo build --workspace --all-targets --features unicorn --target ${{ matrix.target }}
- name: Test (--features unicorn)
run: cargo test --workspace --features unicorn --target ${{ matrix.target }}
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all --check
doc:
name: rustdoc
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cmake
run: sudo apt-get update && sudo apt-get install -y cmake build-essential pkg-config
- run: cargo doc --workspace --no-deps --features unicorn