| 1 |
name: Clippy, Format & Test |
| 2 |
|
| 3 |
on: [pull_request, push, workflow_dispatch] |
| 4 |
|
| 5 |
jobs: |
| 6 |
fmt: |
| 7 |
name: rustfmt |
| 8 |
runs-on: ubuntu-latest |
| 9 |
steps: |
| 10 |
- uses: actions/checkout@v4 |
| 11 |
- uses: dtolnay/rust-toolchain@stable |
| 12 |
with: |
| 13 |
components: rustfmt |
| 14 |
- run: cargo fmt --all -- --check |
| 15 |
- run: cargo fmt --manifest-path=example_project/Cargo.toml --all -- --check |
| 16 |
|
| 17 |
check: |
| 18 |
name: cargo check |
| 19 |
runs-on: ubuntu-latest |
| 20 |
strategy: |
| 21 |
matrix: |
| 22 |
toolchain: [stable, "1.81"] |
| 23 |
steps: |
| 24 |
- uses: actions/checkout@v4 |
| 25 |
- uses: dtolnay/rust-toolchain@stable |
| 26 |
with: |
| 27 |
toolchain: ${{ matrix.toolchain }} |
| 28 |
- run: cargo check --no-default-features |
| 29 |
- run: cargo check --no-default-features --features cargo-lock |
| 30 |
- run: cargo check --no-default-features --features dependency-tree |
| 31 |
- run: cargo check --no-default-features --features git2 |
| 32 |
- run: cargo check --no-default-features --features semver |
| 33 |
- run: cargo check --no-default-features --features chrono |
| 34 |
- run: cargo check --all-features |
| 35 |
- run: cargo check --manifest-path=example_project/Cargo.toml |
| 36 |
|
| 37 |
semver_crate: |
| 38 |
name: cargo check of internal crate |
| 39 |
runs-on: ubuntu-latest |
| 40 |
strategy: |
| 41 |
matrix: |
| 42 |
toolchain: [stable, "1.83"] |
| 43 |
steps: |
| 44 |
- uses: actions/checkout@v4 |
| 45 |
- uses: dtolnay/rust-toolchain@stable |
| 46 |
with: |
| 47 |
toolchain: ${{ matrix.toolchain }} |
| 48 |
- run: cargo check --manifest-path=semver_check/Cargo.toml |
| 49 |
|
| 50 |
clippy: |
| 51 |
name: cargo clippy |
| 52 |
runs-on: ubuntu-latest |
| 53 |
steps: |
| 54 |
- uses: actions/checkout@v4 |
| 55 |
- uses: dtolnay/rust-toolchain@stable |
| 56 |
with: |
| 57 |
components: clippy |
| 58 |
- run: cargo clippy --all --tests -- -D warnings |
| 59 |
- run: cargo clippy --all-features --all --tests -- -D warnings |
| 60 |
- run: cargo clippy --manifest-path=example_project/Cargo.toml --all --tests -- --warn clippy::pedantic -D warnings |
| 61 |
|
| 62 |
test: |
| 63 |
name: cargo test |
| 64 |
strategy: |
| 65 |
matrix: |
| 66 |
os: [ubuntu-latest, windows-latest, macos-latest] |
| 67 |
toolchain: [stable, nightly] |
| 68 |
runs-on: ${{ matrix.os }} |
| 69 |
steps: |
| 70 |
- uses: actions/checkout@v4 |
| 71 |
- uses: dtolnay/rust-toolchain@master |
| 72 |
with: |
| 73 |
targets: x86_64-unknown-none |
| 74 |
toolchain: ${{ matrix.toolchain }} |
| 75 |
- if: matrix.toolchain == 'nightly' |
| 76 |
run: echo "RUSTFLAGS=-Zfmt-debug=none" >> $GITHUB_ENV |
| 77 |
- run: cargo test --no-default-features |
| 78 |
- run: cargo test --all-features |
| 79 |
- run: cargo test -- --ignored nostd_testbox |
| 80 |
- run: cargo run --manifest-path=example_project/Cargo.toml |
| 81 |
|
| 82 |
semver: |
| 83 |
name: Semver check |
| 84 |
runs-on: ubuntu-latest |
| 85 |
steps: |
| 86 |
- uses: actions/checkout@v4 |
| 87 |
- run: sudo apt update && sudo apt install -y cmake |
| 88 |
- uses: obi1kenobi/cargo-semver-checks-action@v2 |