forked from shadow/shadow
-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (138 loc) · 5.68 KB
/
Copy pathlint.yml
File metadata and controls
154 lines (138 loc) · 5.68 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Syntax reference:
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
name: Lint Checks
permissions: read-all
on:
pull_request:
types: [opened, synchronize]
env:
CARGO_TERM_COLOR: always
jobs:
lint-python:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
# Run on PR head instead of merge result. Running on the merge
# result can give confusing results, and we require PR to be up to
# date with target branch before merging, anyway.
# See https://github.com/shadow/shadow/issues/2166
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- run: pip install flake8
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude src/external
lint-python-mypy:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
# Run on PR head instead of merge result. Running on the merge
# result can give confusing results, and we require PR to be up to
# date with target branch before merging, anyway.
# See https://github.com/shadow/shadow/issues/2166
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v6
with:
# Oldest python version supported by shadowtools package.
# See shadowtools/pyproject.toml, `requires-python`
python-version: '3.9'
# Last bumped 2024-12-02
- run: pip install mypy==1.11.2
# Type annotations of dependencies
- run: pip install types-networkx types-pyyaml
# Run mypy in non-strict code on ~everything.
# The `bindings-build` directory shouldn't actually exist in this CI job,
# but this exclusion will be wanted when running locally.
- run: find . -name bindings-build -prune -o -name '*.py' -print | xargs -n1 mypy
# Run mypy --strict where supported.
- run: mypy --strict shadowtools
lint-shell:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
# Run on PR head instead of merge result. Running on the merge
# result can give confusing results, and we require PR to be up to
# date with target branch before merging, anyway.
# See https://github.com/shadow/shadow/issues/2166
ref: ${{ github.event.pull_request.head.sha }}
- run: sudo apt-get update
- run: sudo apt-get install shellcheck
- run: find . -name '*.sh' | xargs shellcheck
lint-rust:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
# Run on PR head instead of merge result. Running on the merge
# result can give confusing results, and we require PR to be up to
# date with target branch before merging, anyway.
# See https://github.com/shadow/shadow/issues/2166
ref: ${{ github.event.pull_request.head.sha }}
- name: Set Rust toolchain
run: ln -s ci/rust-toolchain-stable.toml rust-toolchain.toml
- name: check rust version
run: cargo --version
- name: Add rustfmt
run: rustup component add rustfmt
- name: Rustfmt check
run: (cd src && cargo fmt -- --check)
lint-clippy:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
# Run on PR head instead of merge result. Running on the merge
# result can give confusing results, and we require PR to be up to
# date with target branch before merging, anyway.
# See https://github.com/shadow/shadow/issues/2166
ref: ${{ github.event.pull_request.head.sha }}
# Our rust build scripts require libglib.
- run: sudo apt-get update
- name: Install system dependencies
run: sudo apt-get install -y libglib2.0-dev
- name: Set Rust toolchain
run: ln -s ci/rust-toolchain-stable.toml rust-toolchain.toml
- name: check rust version
run: cargo --version
- name: Add clippy
run: rustup component add clippy
- name: clippy
run: (cd src && cargo clippy --all-targets -- -Dwarnings)
lint-cargo-lock:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: Cargo update check
run: |
# This will return an error if any versions of local crates in the Cargo.lock
# are out of date compared to the crate versions in Cargo.toml. This can fail
# if the Shadow version is bumped without using Cargo to update the lock file.
(cd src && cargo update --locked --workspace)
lint-cargo-doc:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
# Run on PR head instead of merge result. Running on the merge
# result can give confusing results, and we require PR to be up to
# date with target branch before merging, anyway.
# See https://github.com/shadow/shadow/issues/2166
ref: ${{ github.event.pull_request.head.sha }}
# Our rust build scripts require libglib.
- run: sudo apt-get update
- name: Install system dependencies
run: sudo apt-get install -y libglib2.0-dev
- name: Set Rust toolchain
run: ln -s ci/rust-toolchain-stable.toml rust-toolchain.toml
- name: check rust version
run: cargo --version
- name: Add rustdoc
run: rustup component add rust-docs
- name: Cargo doc check
run: (cd src && RUSTDOCFLAGS='-D warnings' cargo doc)