Skip to content

Commit 853d7ee

Browse files
joshrotenbergflip1995
authored andcommitted
Book: add a ci chapter
1 parent 4e6b55e commit 853d7ee

File tree

6 files changed

+59
-24
lines changed

6 files changed

+59
-24
lines changed

book/src/SUMMARY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
- [Pendantic]()
1414
- [Nursery]()
1515
- [Cargo]()
16+
- [Continuous Integration](continuous_integration/README.md)
17+
- [Travis CI](continuous_integration/travis.md)
18+
- [GitHub Actions](continuous_integration/github_actions.md)
19+
- [Gitlab](continuous_integration/gitlab.md)
1620
- [Development](development/README.md)
1721
- [Basics](development/basics.md)
1822
- [Adding Lints](development/adding_lints.md)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Continuous Integration
2+
3+
- [Travis CI](travis.md)
4+
- [Github Actions](github_actions.md)
5+
- [Gitlab](gitlab.md)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# GitHub Actions
2+
3+
## actions-rs
4+
5+
An easy way to get started with adding Clippy to GitHub Actions is
6+
the [actions-rs](https://github.com/actions-rs) [clippy-check](https://github.com/actions-rs/clippy-check):
7+
8+
```yml
9+
on: push
10+
name: Clippy check
11+
jobs:
12+
clippy_check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Run Clippy
17+
run: cargo clippy
18+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Gitlab
2+
3+
***placeholder***
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Travis CI
2+
3+
You can add Clippy to Travis CI in the same way you use it locally:
4+
5+
```yml
6+
language: rust
7+
rust:
8+
- stable
9+
- beta
10+
before_script:
11+
- rustup component add clippy
12+
script:
13+
- cargo clippy
14+
# if you want the build job to fail when encountering warnings, use
15+
- cargo clippy -- -D warnings
16+
# in order to also check tests and non-default crate features, use
17+
- cargo clippy --all-targets --all-features -- -D warnings
18+
- cargo test
19+
# etc.
20+
```
21+
22+
Note that adding `-D warnings` will cause your build to fail if **any** warnings are found in your code.
23+
That includes warnings found by rustc (e.g. `dead_code`, etc.). If you want to avoid this and only cause
24+
an error for Clippy warnings, use `#![deny(clippy::all)]` in your code or `-D clippy::all` on the command
25+
line. (You can swap `clippy::all` with the specific lint category you are targeting.)

book/src/installation_and_usage.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,8 @@ clippy-driver --edition 2018 -Cpanic=abort foo.rs
8181

8282
Note that `rustc` will still run, i.e. it will still emit the output files it normally does.
8383

84-
### Travis CI
85-
86-
You can add Clippy to Travis CI in the same way you use it locally:
87-
88-
```yml
89-
language: rust
90-
rust:
91-
- stable
92-
- beta
93-
before_script:
94-
- rustup component add clippy
95-
script:
96-
- cargo clippy
97-
# if you want the build job to fail when encountering warnings, use
98-
- cargo clippy -- -D warnings
99-
# in order to also check tests and non-default crate features, use
100-
- cargo clippy --all-targets --all-features -- -D warnings
101-
- cargo test
102-
# etc.
103-
```
84+
### Continuous Integration
85+
86+
Adding Clippy to your continuous integration pipeline is a great way to automate the linting process. See the
87+
[Continuous Integration](continuous_integration) chapter for more information.
10488

105-
Note that adding `-D warnings` will cause your build to fail if **any** warnings are found in your code.
106-
That includes warnings found by rustc (e.g. `dead_code`, etc.). If you want to avoid this and only cause
107-
an error for Clippy warnings, use `#![deny(clippy::all)]` in your code or `-D clippy::all` on the command
108-
line. (You can swap `clippy::all` with the specific lint category you are targeting.)

0 commit comments

Comments
 (0)