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