name: Rust CI
on:
push:
pull_request:
jobs:
format:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Lint with Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: clippy
- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
build:
name: Build ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
name: Windows (64-bit)
- os: windows-latest
target: aarch64-pc-windows-msvc
name: Windows (ARM)
cross: true
- os: macos-latest
target: x86_64-apple-darwin
name: macOS (64-bit)
- os: macos-latest
target: aarch64-apple-darwin
name: macOS (ARM)
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
name: Linux (64-bit)
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install CUPS (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install -y libcups2-dev
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
override: true
- name: Install cross-compilation tools
if: matrix.cross
run: |
rustup target add ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test