Merge CI/CD files #103
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: | |
branches: | |
- main | |
push: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
# Cancel any currently running workflows from the same PR, branch, or | |
# tag when a new workflow is triggered. | |
# | |
# https://stackoverflow.com/a/66336834 | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
jobs: | |
# -------------------------------------------------------------------------- | |
# Check | |
check: | |
name: Check (${{ matrix.platform.target }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os: "macos-12" | |
target: "x86_64-apple-darwin" | |
arch: "x86_64" | |
- os: "ubuntu-22.04" | |
target: "x86_64-unknown-linux-gnu" | |
arch: "x86_64" | |
- os: "ubuntu-22.04" | |
target: "x86_64-unknown-linux-musl" | |
arch: "x86_64" | |
- os: "windows-2022" | |
target: "x86_64-pc-windows-msvc" | |
arch: "x86_64" | |
- os: "ubuntu-22.04" | |
target: "aarch64-unknown-linux-gnu" | |
arch: "arm64" | |
features: "--features=raspberry" | |
- os: "ubuntu-22.04" | |
target: "armv7-unknown-linux-gnueabihf" | |
arch: "armhf" | |
features: "--features=raspberry" | |
runs-on: ${{ matrix.platform.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-target | |
with: | |
arch: ${{ matrix.platform.arch }} | |
target: ${{ matrix.platform.target }} | |
- run: cargo check ${{ matrix.platform.features }} | |
check-lib: | |
name: Check lib (${{ matrix.platform.target }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- target: "x86_64-unknown-linux-gnu" | |
arch: "x86_64" | |
- target: "aarch64-unknown-linux-gnu" | |
arch: "arm64" | |
features: "--features=raspberry" | |
- target: "armv7-unknown-linux-gnueabihf" | |
arch: "armhf" | |
features: "--features=raspberry" | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-target | |
with: | |
arch: ${{ matrix.platform.arch }} | |
target: ${{ matrix.platform.target }} | |
- run: cargo check --lib --no-default-features ${{ matrix.platform.features }} | |
msrv: | |
name: Check MSRV (${{ matrix.platform.target }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- target: "x86_64-unknown-linux-gnu" | |
arch: "x86_64" | |
- target: "aarch64-unknown-linux-gnu" | |
arch: "arm64" | |
features: "--features=raspberry" | |
- target: "armv7-unknown-linux-gnueabihf" | |
arch: "armhf" | |
features: "--features=raspberry" | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-target | |
with: | |
arch: ${{ matrix.platform.arch }} | |
target: ${{ matrix.platform.target }} | |
toolchain: "1.65" | |
- run: cargo check ${{ matrix.platform.features }} | |
# -------------------------------------------------------------------------- | |
# Test | |
test: | |
name: Unit Tests (${{ matrix.platform.target }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- target: "x86_64-unknown-linux-gnu" | |
arch: "x86_64" | |
- target: "aarch64-unknown-linux-gnu" | |
arch: "arm64" | |
features: "--features=raspberry" | |
- target: "armv7-unknown-linux-gnueabihf" | |
arch: "armhf" | |
features: "--features=raspberry" | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-target | |
with: | |
arch: ${{ matrix.platform.arch }} | |
target: ${{ matrix.platform.target }} | |
- run: cargo test --lib ${{ matrix.platform.features }} | |
# -------------------------------------------------------------------------- | |
# Lint | |
clippy: | |
name: Clippy (${{ matrix.platform.target }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- target: "x86_64-unknown-linux-gnu" | |
arch: "x86_64" | |
- target: "aarch64-unknown-linux-gnu" | |
arch: "arm64" | |
features: "--features=raspberry" | |
- target: "armv7-unknown-linux-gnueabihf" | |
arch: "armhf" | |
features: "--features=raspberry" | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup-target | |
with: | |
arch: ${{ matrix.platform.arch }} | |
target: ${{ matrix.platform.target }} | |
components: clippy | |
- run: cargo clippy ${{ matrix.platform.features }} -- -D warnings -A clippy::too_many_arguments | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --all -- --check |