name: Rust CI
on:
push:
branches: [master, dev]
pull_request:
branches: [dev]
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Format check
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt
- name: Check formatting
run: |
cargo fmt -- --check
build:
needs: fmt
strategy:
fail-fast: false
matrix:
include:
- name: Windows 2019 x86_64
os: windows-2019
target: x86_64-pc-windows-msvc
- name: Windows 2022 x86_64
os: windows-2022
target: x86_64-pc-windows-msvc
- name: MacOS 10.15 x86_64
os: macos-10.15
target: x86_64-apple-darwin
- name: MacOS 11 x86_64
os: macos-11
target: x86_64-apple-darwin
- name: Linux Ubuntu 18.04 x86_64
os: ubuntu-18.04
target: x86_64-unknown-linux-gnu
- name: Linux Ubuntu 20.04 x86_64
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
name: Check ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
override: true
components: clippy
- name: Install Linux libs
if: ${{ startsWith(matrix.os, 'ubuntu') == 1 }}
run: |
sudo apt-get update -y -qq
sudo apt-get install -y libxkbcommon-dev
- name: Caching project
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}-a
- name: Disable debug
shell: bash
run: |
mkdir .cargo
echo """[profile.dev]
debug = 1" > .cargo/config.toml
- name: Check no features
run: |
cargo clippy --target ${{ matrix.target }}
- name: Check all features
run: |
cargo clippy --target ${{ matrix.target }} --examples --tests --all-features
- name: Build docs
run: |
cargo doc --target ${{ matrix.target }} --no-deps
- name: Run tests
run: |
cargo test --target ${{ matrix.target }}