Skip to content

Commit

Permalink
CI: Simplify workflow, restrict permissions, test more extensively, b…
Browse files Browse the repository at this point in the history
…uild the docs too
  • Loading branch information
pentamassiv committed Oct 22, 2023
1 parent 060e9e4 commit 7e82cc5
Showing 1 changed file with 35 additions and 65 deletions.
100 changes: 35 additions & 65 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,93 +18,63 @@

name: CI

permissions:
contents: read
on:
push:
branches:
- master
pull_request:
workflow_dispatch:

env:
RUSTFLAGS: -Dwarnings
clippy_version: 1.60.0
CARGO_TERM_COLOR: always

jobs:
rustfmt:
name: rustfmt
CI:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- rust: stable
rust:
- stable
- beta
- nightly
- 1.48.0

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
components: rustfmt
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v1
- name: Run rustfmt
if: matrix.rust == 'stable' # Avoid differences between the versions
run: cargo fmt --check

clippy:
name: clippy
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.clippy_version }}
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --tests --all-features

test:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- uses: Swatinem/rust-cache@v1

- name: Test
if: matrix.rust == 'stable' # Avoid differences between the versions
run: cargo clippy --all-features
- name: Check clippy lints for the examples
if: matrix.rust == 'stable' # Avoid differences between the versions
run: cargo clippy --all-features --examples
- name: Check clippy lints for the tests
if: matrix.rust == 'stable' # Avoid differences between the versions
run: cargo clippy --all-features --tests
- name: Build the crate
run: cargo build --all-features
- name: Build the examples
run: cargo build --all-features --examples
- name: Run the tests
run: cargo test
- name: Run the tests with all features enabled
run: cargo test --all-features
- name: Build the docs
run: cargo doc
- name: Build the docs with all features enabled
run: cargo doc --all-features

msrv:
name: Build MSRV
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.48.0
override: true
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo build


0 comments on commit 7e82cc5

Please sign in to comment.