forked from Xudong-Huang/may
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (121 loc) · 3.7 KB
/
Copy pathrust.yml
File metadata and controls
126 lines (121 loc) · 3.7 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: CI
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
lints:
name: Run cargo fmt and cargo clippy
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: cargo fmt --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy (strict)
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -D warnings -D clippy::correctness -D clippy::suspicious -D clippy::complexity -D clippy::perf -D clippy::style
- name: Run cargo clippy no default features (strict)
uses: actions-rs/cargo@v1
with:
command: clippy
args: --no-default-features --all-targets -- -D warnings -D clippy::correctness -D clippy::suspicious -D clippy::complexity -D clippy::perf -D clippy::style
- name: Run cargo clippy with selected pedantic lints
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -D warnings -D clippy::cast_lossless -D clippy::redundant_closure_for_method_calls -D clippy::uninlined_format_args -D clippy::manual_is_multiple_of -D clippy::needless_continue -D clippy::needless_for_each
security:
name: Security audit and additional checks
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-security-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo check with strict flags
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets --all-features
- name: Check documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features --no-deps
test:
name: Test ${{ matrix.rust }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust:
- stable
- nightly
os:
- ubuntu-latest
- windows-latest
- macOS-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust (${{ matrix.rust }})
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
- name: Run cargo release test
uses: actions-rs/cargo@v1
with:
command: test
args: --release