Skip to content

Commit

Permalink
Fix CI workflow and improve its performance
Browse files Browse the repository at this point in the history
  • Loading branch information
zheland committed Feb 19, 2024
1 parent 6bce0e0 commit b728136
Showing 1 changed file with 86 additions and 36 deletions.
122 changes: 86 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,92 @@ defaults:
run:
shell: bash

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: Build
cargo-fmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install nightly --profile minimal --component rustfmt
- run: cargo +nightly fmt --all -- --check

cargo-clippy:
name: Run linter
runs-on: ubuntu-latest
strategy:
matrix:
rust-toolchain:
- stable
- beta
- nightly
- 1.70.0
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install ${{ matrix.rust-toolchain }} --profile minimal --component clippy
- run: rustup default ${{ matrix.rust-toolchain }}
- run: cargo clippy --all-targets --no-default-features -- -D warnings
- run: cargo clippy --all-targets -- -D warnings
- run: cargo clippy --all-targets --no-default-features --features "std" -- -D warnings
- run: cargo clippy --all-targets --no-default-features --features "detect-color-support" -- -D warnings
- run: cargo clippy --all-targets --no-default-features --features "custom-default-colors" -- -D warnings
- run: cargo clippy --all-targets --all-features -- -D warnings

cargo-test:
name: Test sources
runs-on: ubuntu-latest
strategy:
matrix:
rust-toolchain:
- stable
- beta
- nightly
- 1.70.0
cargo-flags:
- ""
- "--release"
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install ${{ matrix.rust-toolchain }} --profile minimal
- run: rustup default ${{ matrix.rust-toolchain }}
- run: cargo test --all-targets ${{ matrix.cargo-flags }} --no-default-features -- -D warnings
- run: cargo test --all-targets ${{ matrix.cargo-flags }} -- -D warnings
- run: cargo test --all-targets ${{ matrix.cargo-flags }} --no-default-features --features "std" -- -D warnings
- run: cargo test --all-targets ${{ matrix.cargo-flags }} --no-default-features --features "detect-color-support" -- -D warnings
- run: cargo test --all-targets ${{ matrix.cargo-flags }} --no-default-features --features "custom-default-colors" -- -D warnings
- run: cargo test --all-targets ${{ matrix.cargo-flags }} --all-features -- -D warnings

cargo-check-no-alloc:
name: Check no-alloc compatibility
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tests/no-alloc
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal
- run: cargo clippy -- -D warnings
- run: cargo build

cargo-check-no-std:
name: Check no-std compatibility
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tests/no-std
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal
- run: cargo clippy -- -D warnings
- run: cargo build

cargo-deny:
name: Check licenses/bans/advisories/sources
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
components: clippy

- name: Install Rust beta toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: beta
components: clippy, llvm-tools

- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: clippy, rustfmt

- name: Install Rust 1.70.0 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.0
components: clippy

- name: Run build and test script
run: ./check.sh
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal
- run: cargo install cargo-deny
- run: cargo deny --workspace --all-features check

0 comments on commit b728136

Please sign in to comment.