2023-04-25 16:38:59 +02:00
|
|
|
name: "Check, lint and test using Cargo"
|
2023-03-21 11:15:55 +01:00
|
|
|
|
|
|
|
on:
|
|
|
|
- pull_request
|
2023-04-25 16:38:59 +02:00
|
|
|
- push
|
2023-03-21 11:15:55 +01:00
|
|
|
- workflow_dispatch
|
|
|
|
|
|
|
|
jobs:
|
2023-04-25 16:38:59 +02:00
|
|
|
check_lint:
|
|
|
|
name: Check, lint and test
|
2023-03-21 11:15:55 +01:00
|
|
|
runs-on: debian-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: https://github.com/actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2023-04-25 16:38:59 +02:00
|
|
|
components: rustfmt, clippy
|
2023-03-21 11:15:55 +01:00
|
|
|
|
2023-03-21 11:50:00 +01:00
|
|
|
- name: Use sparse Cargo index for crates.io
|
|
|
|
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
|
|
|
|
|
2023-03-21 11:15:55 +01:00
|
|
|
- name: Run cargo check
|
|
|
|
uses: https://github.com/actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: check
|
|
|
|
|
2023-04-25 16:38:59 +02:00
|
|
|
- name: Run cargo clippy
|
2023-03-21 11:15:55 +01:00
|
|
|
uses: https://github.com/actions-rs/cargo@v1
|
|
|
|
with:
|
2023-04-25 16:38:59 +02:00
|
|
|
command: clippy
|
|
|
|
args: -- -D warnings
|
2023-03-21 11:50:00 +01:00
|
|
|
|
2023-03-21 11:15:55 +01:00
|
|
|
- name: Run cargo fmt
|
|
|
|
uses: https://github.com/actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: fmt
|
|
|
|
args: --all -- --check
|
|
|
|
|
2023-04-25 16:38:59 +02:00
|
|
|
- name: Run cargo test
|
2023-03-21 11:15:55 +01:00
|
|
|
uses: https://github.com/actions-rs/cargo@v1
|
|
|
|
with:
|
2023-04-25 16:38:59 +02:00
|
|
|
command: test
|
|
|
|
args: --all-features
|