Skip to content

Commit

Permalink
Improve CI (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Dec 14, 2023
1 parent ddbfcd2 commit 3602c57
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 81 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Audit

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
audit:
Expand All @@ -9,17 +19,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Cache cargo-audit
uses: actions/cache@v3
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/cargo-audit
key: cargo-audit
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Checkout
uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: cargo-audit
- name: Run Audit
run: cargo audit -D warnings
34 changes: 18 additions & 16 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Format

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
rustfmt:
Expand All @@ -9,33 +19,25 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Update Rust
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust nightly
run: |
rustup toolchain install nightly --profile minimal --component rustfmt --allow-downgrade
rustup default nightly
- name: Checkout
uses: actions/checkout@v4
- name: Run Rustfmt
run:
cargo fmt --check
run: cargo fmt --check

taplo:
name: Taplo

runs-on: ubuntu-latest

steps:
- name: Cache Taplo
uses: actions/cache@v3
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/taplo
key: taplo
- name: Install Taplo
run: cargo install taplo-cli
- name: Checkout
uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: taplo-cli
- name: Run Taplo
run: taplo fmt --check
24 changes: 17 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
name: Lint

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
clippy-rustdoc:
name: Clippy + Rustdoc
name: Clippy & Rustdoc

runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand Down Expand Up @@ -33,15 +45,13 @@ jobs:
- channel: nightly
features: --all-features

runs-on: ubuntu-latest

steps:
- name: Update Rust
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install ${{ matrix.channel }} --profile minimal --component clippy --allow-downgrade
rustup default ${{ matrix.channel }}
- name: Checkout
uses: actions/checkout@v4
- name: Run Clippy
run:
cargo clippy --all-targets --workspace ${{ matrix.features }} -- -D warnings
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Publish

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
publish:
Expand All @@ -12,5 +22,4 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Test Publish
run:
cargo publish --dry-run
run: cargo publish --dry-run
49 changes: 32 additions & 17 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
name: Spellcheck

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
rustfmt:
spellcheck:
name: Spellcheck

runs-on: ubuntu-latest

steps:
- name: Cache cargo-spellcheck
uses: actions/cache@v3
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/cargo-spellcheck
key: cargo-spellcheck
- name: Install libclang-dev
run: sudo apt-get install libclang-dev
- name: Install cargo-spellcheck
run: cargo install cargo-spellcheck --locked
- name: Checkout
uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: cargo-spellcheck
- name: Run Spellcheck
run: cargo spellcheck check -m 1 2>/dev/null
- name: Run Spellcheck on CHANGELOG.md
run: cargo spellcheck check -m 1 CHANGELOG.md 2>/dev/null
run: |
cargo spellcheck check -m 1
cargo spellcheck check -m 1 CHANGELOG.md
typos:
name: Typos

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: typos-cli
- name: Run Typos
run: typos
52 changes: 33 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
name: Test

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
build-test:
name: Build + Test
name: Build & Test

runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand All @@ -21,6 +33,8 @@ jobs:
- --features safe,zeroize
- --features safe,zeroize-on-drop
include:
- rust: 1.57.0
msrv: true
- rust: nightly
features: --features nightly
- rust: nightly
Expand All @@ -32,17 +46,15 @@ jobs:
- rust: nightly
features: --all-features

runs-on: ubuntu-latest

steps:
- name: Update Rust
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install ${{ matrix.rust }} --profile minimal --allow-downgrade
rustup default ${{ matrix.rust }}
- name: Checkout
uses: actions/checkout@v4
- name: Pin `zeroize` for MSRV
if: matrix.rust == '1.57.0'
if: matrix.msrv
run:
cargo update -p zeroize --precise 1.6.0
- name: Build
Expand All @@ -58,6 +70,8 @@ jobs:
no-std-build:
name: no_std Build

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
Expand All @@ -73,6 +87,8 @@ jobs:
- --features safe,zeroize
- --features safe,zeroize-on-drop
include:
- rust: 1.57.0
msrv: true
- rust: nightly
features: --features nightly
- rust: nightly
Expand All @@ -84,17 +100,15 @@ jobs:
- rust: nightly
features: --all-features

runs-on: ubuntu-latest

steps:
- name: Update Rust
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install ${{ matrix.rust }} --target thumbv6m-none-eabi --profile minimal --allow-downgrade
rustup default ${{ matrix.rust }}
- name: Checkout
uses: actions/checkout@v4
- name: Pin `zeroize` for MSRV
if: matrix.rust == '1.57.0'
if: matrix.msrv
run:
cargo update -p zeroize --precise 1.6.0
- name: Build
Expand All @@ -104,6 +118,8 @@ jobs:
minimal-versions:
name: Minimal Versions

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
Expand All @@ -113,18 +129,16 @@ jobs:
- version: stable
features: safe,zeroize-on-drop

runs-on: ubuntu-latest

steps:
- name: Update Rust
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install ${{ matrix.rust.version }} --profile minimal --allow-downgrade
rustup default ${{ matrix.rust.version }}
- name: Install nightly Rust
run:
rustup toolchain install nightly --profile minimal --allow-downgrade
- name: Checkout
uses: actions/checkout@v4
- name: Build
working-directory: test-crates/minimal-versions
run: |
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
name: Validate

on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
miri:
name: Miri

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
features:
- ""
- --features nightly

runs-on: ubuntu-latest

steps:
- name: Update Rust
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: |
rustup toolchain install nightly --profile minimal --component miri,rust-src --allow-downgrade
rustup default nightly
- name: Checkout
uses: actions/checkout@v4
- name: Test
run:
cargo miri test --workspace ${{ matrix.features }} --all-targets --no-fail-fast
Loading

0 comments on commit 3602c57

Please sign in to comment.