-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
95 lines (92 loc) · 2.45 KB
/
config.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# https://circleci.com/docs/2.0/
version: 2
images:
- &rust_image
# https://hub.docker.com/r/circleci/rust
image: circleci/rust:1.50.0-buster
jobs:
checkout_code:
docker:
- <<: *rust_image
steps:
- checkout
- run:
name: Output Rust environment
command: rustc --version; cargo --version; rustup --version;
- persist_to_workspace:
root: .
paths:
- .
check_code_format:
docker:
- <<: *rust_image
steps:
- attach_workspace:
at: .
- run:
name: Check Rust code format
command: cargo fmt --all -- --check
lint_code:
docker:
- <<: *rust_image
steps:
- attach_workspace:
at: .
- run:
name: Install clippy
command: rustup component add clippy
- run:
name: Lint Rust code, failing on warnings from default linters and warning about cargo manifest linters
command: cargo clippy -- --deny clippy::all --warn clippy::cargo
run_tests:
docker:
- <<: *rust_image
steps:
- attach_workspace:
at: .
- run:
name: Run tests
command: cargo test
# CHANGEME: Depending on the type of project built (Use version with --locked for an application. For a library, delete this comment block)
# name: Run tests (while enforcing Cargo.lock to be up to date)
# command: cargo test --locked
audit_dependencies:
docker:
- <<: *rust_image
steps:
- attach_workspace:
at: .
- run:
name: Set permissions for cache
command: |
sudo chown --recursive $(whoami):$(id --name --group) /usr/local/cargo
- restore_cache:
keys:
- cargo-audit-{{ arch }}
- run:
name: Install cargo-audit
command: cargo install cargo-audit
- save_cache:
paths:
- /usr/local/cargo
key: cargo-audit-{{ arch }}
- run:
name: Audit Cargo.lock files for crates with security vulnerabilities
command: cargo audit
workflows:
version: 2
default:
jobs:
- checkout_code
- check_code_format:
requires:
- checkout_code
- lint_code:
requires:
- checkout_code
- run_tests:
requires:
- checkout_code
- audit_dependencies:
requires:
- checkout_code