155 lines
3.6 KiB
YAML
155 lines
3.6 KiB
YAML
name: Rust CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
merge_group:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
fmt:
|
|
name: cargo fmt
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1
|
|
with:
|
|
components: rustfmt
|
|
cache-key: fmt
|
|
|
|
- name: Check formatting
|
|
uses: actions-rust-lang/rustfmt@4066006ec54a31931b9b1fddfd38f2fdf2d27143 # v1
|
|
|
|
clippy:
|
|
name: cargo clippy
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1
|
|
with:
|
|
components: clippy
|
|
cache-key: clippy
|
|
|
|
- name: Run clippy
|
|
run: |
|
|
cargo clippy \
|
|
--workspace \
|
|
--all-targets \
|
|
--all-features \
|
|
--locked \
|
|
-- -D warnings
|
|
|
|
- name: Run clippy without default features
|
|
run: |
|
|
cargo clippy \
|
|
--workspace \
|
|
--all-targets \
|
|
--no-default-features \
|
|
--locked \
|
|
-- -D warnings
|
|
|
|
check:
|
|
name: cargo check
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1
|
|
with:
|
|
cache-key: check
|
|
|
|
- name: Run check without default features
|
|
run: |
|
|
cargo check \
|
|
--workspace \
|
|
--no-default-features \
|
|
--locked
|
|
|
|
test:
|
|
name: cargo test
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1
|
|
with:
|
|
cache-key: test
|
|
|
|
- name: Run tests
|
|
run: |
|
|
cargo test \
|
|
--workspace \
|
|
--all-targets \
|
|
--all-features \
|
|
--locked
|
|
|
|
- name: Run tests without default features
|
|
run: |
|
|
cargo test \
|
|
--workspace \
|
|
--no-default-features \
|
|
--locked
|
|
|
|
docs:
|
|
name: cargo doc
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
env:
|
|
RUSTDOCFLAGS: "-D warnings"
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1
|
|
with:
|
|
cache-key: docs
|
|
|
|
- name: Check docs
|
|
run: |
|
|
cargo doc \
|
|
--workspace \
|
|
--all-features \
|
|
--no-deps \
|
|
--locked
|