Skip to content

Commit

Permalink
Refactor CI
Browse files Browse the repository at this point in the history
CI changes:
- replace actions-rs with dtolnay/rust-toolchain
- deny warnings from cargo check
- add cargo-semver-checks-action
- add cargo-check-external-types
  • Loading branch information
chifflier committed Apr 9, 2024
1 parent a69ec1a commit 7398cb8
Showing 1 changed file with 57 additions and 64 deletions.
121 changes: 57 additions & 64 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
on: [push, pull_request]

name: Continuous integration

on:
push:
pull_request:
merge_group:
schedule:
- cron: '0 18 * * *'

jobs:
check:
name: Check
Expand All @@ -13,23 +18,20 @@ jobs:
- 1.63.0
- nightly
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- name: Install ${{ matrix.rust }} toolchain
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Cargo update
run: cargo update
- name: Cargo update (fix for MSRV)
run: cargo update -p time --precise 0.3.20
if: matrix.rust == '1.63.0'
- uses: actions-rs/cargo@v1
with:
command: check
- run: RUSTFLAGS="-D warnings" cargo check

check_features:
name: Check features
test_features:
name: Test suite (with features)
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -39,81 +41,72 @@ jobs:
- --features=bigint,serialize,debug
- --features=bigint,serialize,trace
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cargo update
run: cargo update
- uses: actions-rs/cargo@v1
with:
command: test
args: ${{ matrix.features }}
- uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- run: cargo test ${{ matrix.features }}

no_std:
name: no-std
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features
- uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- run: RUSTFLAGS="-D warnings" cargo check --no-default-features

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- name: Install stable rustfmt
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
components: rustfmt
- run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
- uses: actions/checkout@v4
- name: Install nightly clippy
uses: dtolnay/rust-toolchain@nightly
with:
command: clippy
args: --all-features -- -D warnings
components: clippy
- run: cargo clippy -- -D warnings

doc:
name: Build documentation
runs-on: ubuntu-latest
# this can be removed when cargo-doc stops panic'ing in collect_intra_doc_links
continue-on-error: true
env:
RUSTDOCFLAGS: --cfg docsrs
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1
- uses: actions/checkout@v4
- name: Install nightly rust
uses: dtolnay/rust-toolchain@nightly
- run: cargo doc --workspace --no-deps --all-features

semver:
name: Check semver compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2

check-external-types:
name: Validate external types appearing in public API
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
command: doc
args: --workspace --no-deps --all-features
toolchain: nightly-2024-02-07
# ^ sync with https://github.com/awslabs/cargo-check-external-types/blob/main/rust-toolchain.toml
- run: cargo install cargo-check-external-types
- run: cargo check-external-types

0 comments on commit 7398cb8

Please sign in to comment.