-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (62 loc) · 1.97 KB
/
cargo-lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
name: Cargo lints & tests
on:
workflow_call:
inputs:
toolchain:
required: true
type: string
exclusions:
required: false
type: string
default: ''
jobs:
lint:
runs-on: ubuntu-22.04
# Redis can be required to run tests
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Dump Github variables
uses: crazy-max/ghaction-dump-context@v1
- uses: actions/checkout@v3
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ inputs.toolchain }}
components: rustfmt, clippy
- name: Install tooling for benchmarks
run: |
sudo apt update
sudo apt install -y gnuplot
cargo install --locked criterion-table || true
cargo install --locked cargo-criterion || true
# Ensure all code has been formatted with rustfmt
- name: Check formatting
run: cargo fmt --all -- --check --color always
- name: Static analysis
run: cargo clippy --workspace ${{ inputs.exclusions }} --all-targets --all-features -- -D warnings
- name: Run tests
run: |
cargo test --release --workspace ${{ inputs.exclusions }} --all-targets --all-features
- name: Run doc tests
run: cargo test --release --workspace ${{ inputs.exclusions }} --all-features --doc