name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
RUST_BACKTRACE: 1
jobs:
test:
name: Test Rust ${{ matrix.rust }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { rust: nightly, os: ubuntu-latest }
- { rust: nightly, os: macos-latest }
- { rust: nightly, os: windows-latest }
- { rust: stable, os: ubuntu-latest }
- { rust: stable, os: macos-latest }
- { rust: stable, os: windows-latest }
- { rust: 1.49.0, os: ubuntu-latest }
- { rust: 1.49.0, os: macos-latest }
- { rust: 1.49.0, os: windows-latest }
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Install cargo-hack
run: cargo install cargo-hack
- uses: Swatinem/rust-cache@v1
- name: Check Cargo availability
run: cargo --version
- name: Run tests with default features
run: cargo hack test --verbose --workspace
- name: Run tests with all features
run: cargo hack test --verbose --workspace --all-features
examples:
name: Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-hack
run: cargo install cargo-hack
- uses: Swatinem/rust-cache@v1
- name: Build all examples
run: cargo hack build --verbose --workspace --examples
- name: Build special example for entity-async-graphql that requires features
run: |
cargo build \
--manifest-path integrations/entity-async-graphql/Cargo.toml \
--example user \
--features="macros entity/global entity/macros"
clippy:
name: Lint with clippy
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Install cargo-hack
run: cargo install cargo-hack
- uses: Swatinem/rust-cache@v1
- name: Run clippy --workspace --all-features
run: cargo hack clippy --workspace --all-features
rustfmt:
name: Verify code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v1
- name: Run fmt --all -- --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check