name: CI
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
lint:
name: fmt + clippy + doc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install libsoxr
run: sudo apt-get update && sudo apt-get install -y libsoxr-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy (all features)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: clippy (no default features)
run: cargo clippy --all-targets --no-default-features -- -D warnings
- name: doc (docs.rs parity)
env:
DOCS_RS: "1"
RUSTDOCFLAGS: "-D warnings"
run: cargo doc --no-deps --all-features
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install libsoxr (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libsoxr-dev
- name: Install libsoxr (macOS)
if: runner.os == 'macOS'
run: brew install libsoxr
- name: Set up MSYS2 with soxr + pkg-config (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
id: msys2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-libsoxr
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-tools
- name: Expose MSYS2 soxr to the MSVC build (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$mingw = "${{ steps.msys2.outputs.msys2-location }}\mingw64"
"$mingw\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
"PKG_CONFIG_PATH=$mingw\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --all-features
- name: Test (all features)
run: cargo test --all-features
- name: Test (no default features)
run: cargo test --no-default-features
package:
name: package (publish dry-run)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install libsoxr
run: sudo apt-get update && sudo apt-get install -y libsoxr-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo package
run: cargo package --all-features