Skip to content

Commit 0acc77c

Browse files
committed
CI: Add lint workflow
1 parent 47d2d8a commit 0acc77c

File tree

10 files changed

+105
-2
lines changed

10 files changed

+105
-2
lines changed

.github/workflows/_build_and_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
jobs:
1111
build-and-test:
12+
name: Build and test
1213
runs-on: ubuntu-latest
1314
defaults:
1415
run:

.github/workflows/_lints.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Reusable workflow for lints
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
target:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
clippy:
12+
name: Clippy (MSRV)
13+
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
working-directory: ${{ inputs.target }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Run Clippy
20+
uses: actions-rs/clippy-check@v1
21+
with:
22+
name: ${{ inputs.target }} / Clippy (MSRV)
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
args: >
25+
--manifest-path ${{ inputs.target }}/Cargo.toml
26+
--all-features
27+
--all-targets
28+
--
29+
-D warnings
30+
31+
clippy-beta:
32+
name: Clippy (beta)
33+
runs-on: ubuntu-latest
34+
continue-on-error: true
35+
defaults:
36+
run:
37+
working-directory: ${{ inputs.target }}
38+
steps:
39+
- uses: actions/checkout@v3
40+
- uses: dtolnay/rust-toolchain@beta
41+
id: toolchain
42+
- run: rustup override set ${{ steps.toolchain.outputs.name }}
43+
- name: Run Clippy (beta)
44+
uses: actions-rs/clippy-check@v1
45+
continue-on-error: true
46+
with:
47+
name: ${{ inputs.target }} / Clippy (beta)
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
args: >
50+
--manifest-path ${{ inputs.target }}/Cargo.toml
51+
--all-features
52+
--all-targets
53+
--
54+
-W clippy::all
55+
56+
doc-links:
57+
name: Intra-doc links
58+
runs-on: ubuntu-latest
59+
defaults:
60+
run:
61+
working-directory: ${{ inputs.target }}
62+
steps:
63+
- uses: actions/checkout@v3
64+
- run: cargo fetch
65+
# Requires #![deny(rustdoc::broken_intra_doc_links)] in crates.
66+
- name: Check intra-doc links
67+
run: cargo doc --workspace --document-private-items
68+
69+
fmt:
70+
name: Rustfmt
71+
runs-on: ubuntu-latest
72+
defaults:
73+
run:
74+
working-directory: ${{ inputs.target }}
75+
steps:
76+
- uses: actions/checkout@v3
77+
- run: cargo fmt --all --check

.github/workflows/lints.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Lints
2+
3+
# We only run these lints on trial-merges of PRs to reduce noise.
4+
on:
5+
pull_request:
6+
branches: ["main"]
7+
8+
jobs:
9+
crates:
10+
uses: ./.github/workflows/_lints.yml
11+
with:
12+
target: crates
13+
14+
tools:
15+
uses: ./.github/workflows/_lints.yml
16+
with:
17+
target: tools

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
build:
13+
crates:
1414
uses: ./.github/workflows/_build_and_test.yml
1515
with:
1616
target: crates

crates/alloc/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! *Note:* This currently requires using nightly.
33
44
#![no_std]
5+
#![deny(rustdoc::broken_intra_doc_links)]
56

67
use core::alloc::{GlobalAlloc, Layout};
78
use core::ffi::c_void;

crates/flipperzero/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
#![no_std]
44
#![cfg_attr(test, no_main)]
5+
#![deny(rustdoc::broken_intra_doc_links)]
56

67
#[cfg(feature = "alloc")]
78
extern crate alloc;

crates/rt/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//! is linked directly into the `.text` section.
55
66
#![no_std]
7+
#![deny(rustdoc::broken_intra_doc_links)]
78

89
pub mod manifest;
910
pub mod panic_handler;

crates/sys/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Low-level bindings for the Flipper Zero.
22
33
#![no_std]
4+
#![deny(rustdoc::broken_intra_doc_links)]
45

56
// Features that identify thumbv7em-none-eabihf.
67
// Until target_abi is stable, this also permits thumbv7em-none-eabi.
@@ -20,6 +21,7 @@ mod inlines;
2021
#[allow(non_upper_case_globals)]
2122
#[allow(non_camel_case_types)]
2223
#[allow(non_snake_case)]
24+
#[allow(rustdoc::broken_intra_doc_links)]
2325
mod bindings;
2426

2527
/// Create a static C string.

crates/test/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![no_std]
2+
#![deny(rustdoc::broken_intra_doc_links)]
23

34
pub use flipperzero_test_macros::{tests, tests_runner};
45

tools/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
pub mod storage;
1+
#![deny(rustdoc::broken_intra_doc_links)]
2+
23
pub mod serial;
4+
pub mod storage;

0 commit comments

Comments
 (0)