Update CI.

This commit is contained in:
Sebastian Schmidt 2023-04-13 14:54:01 +03:00
parent 1e14ea1460
commit d3741bfcf2

View File

@ -1,112 +1,183 @@
name: Continuous Integration name: CI
on: [push, pull_request] on:
pull_request:
push:
env:
RUSTFLAGS: -Dwarnings
jobs: jobs:
build_test_format_lint: precheck_default:
name: ${{matrix.command.name}} (${{matrix.toolchain}}) name: Check default
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
override: true
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --lib
precheck_all_features:
name: Check all features
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
override: true
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --all --benches --bins --examples --tests --lib
check_msrv:
needs: [precheck_default, precheck_all_features]
name: Check MSRV with all features
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
rust: [ 1.46.0 ]
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
override: true
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --all --benches --bins --examples --tests --lib
check_platform_compatibility:
needs: [precheck_default, precheck_all_features]
name: Check platform compatibility
runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
toolchain: [stable, beta, nightly, 1.46.0] os: [ubuntu-latest, macOS-latest, windows-latest]
command: rust: [stable]
- name: Check
command: check
args: --all-features
components: ""
- name: Test
command: test
args: --all-features
components: ""
include:
- toolchain: nightly
command:
name: Format
command: fmt
args: --all -- --check
components: rustfmt
- toolchain: nightly
command:
name: Lint
command: clippy
args: --all-features --tests --benches
components: clippy
- toolchain: stable
command:
name: Sync readme
command: sync-readme
args: --check
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@master
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install toolchain - name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: ${{ matrix.toolchain }} toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
override: true override: true
default: true
components: ${{matrix.command.components}}
- name: Install cargo-sync-readme - name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Check
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: install command: check
args: cargo-sync-readme args: --all-features --all --benches --bins --examples --tests --lib
- name: ${{matrix.command.name}} detailed_tests:
uses: actions-rs/cargo@v1 needs: [precheck_default, precheck_all_features]
with: name: Check, test, doc, format and lint with all features
command: ${{matrix.command.command}} runs-on: ${{ matrix.os }}
args: ${{matrix.command.args}} strategy:
fail-fast: false
coveralls_io: matrix:
name: Coverage os: [ubuntu-latest]
runs-on: ubuntu-latest rust: [stable, beta, nightly]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@master
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install toolchain - name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
override: true override: true
default: true
- name: Install cargo-tarpaulin - name: Rust cache
uses: actions-rs/install@v0.1 uses: Swatinem/rust-cache@v2
with: with:
crate: cargo-tarpaulin key: ${{ matrix.os }}
version: latest
use-tool-cache: true
- name: Coverage Report with tarpaulin - name: Check
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: tarpaulin command: check
args: --all --all-features --out Lcov -- --test-threads 1 args: --all-features --all --benches --bins --examples --tests --lib
- name: Upload Coverage - name: Test
uses: coverallsapp/github-action@master uses: actions-rs/cargo@v1
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} command: test
path-to-lcov: ./lcov.info args: --all-features --all
- name: Docs
uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features
- name: Format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Lint
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets