-
Notifications
You must be signed in to change notification settings - Fork 349
265 lines (250 loc) · 9.49 KB
/
Copy pathlinting.yml
File metadata and controls
265 lines (250 loc) · 9.49 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: Linting
# Always run on Pull Requests as then these checks can be marked as required.
on:
push:
branches:
- master
- 'feature/*'
- 'release/*'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
jobs:
# Run isort on the tree.
# This checks .py files only so misses SConstruct and SConscript files are not checked, rather
# for these files check them afterwards. The output-filter will not be installed for this part
# so regressions will be detected but not annotated.
isort:
name: Python isort
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- name: Install extra python packages
run: python3 -m pip install --requirement utils/cq/requirements.txt
- name: Run isort
uses: isort/isort-action@24d8a7a51d33ca7f36c3f23598dafa33f7071326 # v1.1.1
with:
requirementsFiles: "requirements.txt"
- name: Run on SConstruct file.
run: isort --check-only SConstruct
- name: Run on build files.
run: find . -name SConscript | xargs isort --check-only
shell-check:
name: ShellCheck
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run
run: sudo apt-get update && sudo apt-get install shellcheck
- name: Add error parser
run: echo -n "::add-matcher::ci/shellcheck-matcher.json"
- name: Run Shellcheck
# The check will run with this file from the target branch but the code from the PR so
# test for this file before calling it to prevent failures on PRs where this check is
# in the target branch but the PR is not updated to include it.
run: \[ ! -x ci/run_shellcheck.sh \] || ./ci/run_shellcheck.sh
log-check:
name: Logging macro checking
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check DAOS logging macro use.
run: ./utils/cq/d_logging_check.py --github src
ftest-tags:
name: Ftest tag check
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check DAOS ftest tags.
run: \[ ! -x src/tests/ftest/tags.py \] || ./src/tests/ftest/tags.py lint --verbose
flake8-lint:
runs-on: ubuntu-24.04
name: Flake8 check
steps:
- name: Check out source repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- name: Add parser
run: echo -n "::add-matcher::ci/daos-flake-matcher.json"
- name: Add whitespace parser
run: echo -n "::add-matcher::ci/daos-flakew-matcher.json"
- name: Add error parser
run: echo -n "::add-matcher::ci/daos-flakee-matcher.json"
- name: flake8 Lint
uses: py-actions/flake8@84ec6726560b6d5bd68f2a5bed83d62b52bb50ba # v2.3.0
with:
# W503 and W504 are related as they conflict. W503 is the preferred style and all code
# should be using it now.
ignore: 'W503'
exclude: 'src/control/vendor,src/client/pydaos/raw'
max-line-length: '100'
- name: flake8 Lint on SCons files.
uses: py-actions/flake8@84ec6726560b6d5bd68f2a5bed83d62b52bb50ba # v2.3.0
with:
ignore: 'F821,W503,F841'
max-line-length: '100'
args: '--filename */SConscript, SConstruct'
doxygen:
name: Doxygen
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install doxygen
run: sudo apt-get install doxygen
- name: Add parser
run: echo -n "::add-matcher::ci/daos-doxygen-matcher.json"
- name: Run check
run: doxygen Doxyfile
- name: 'Upload Artifact'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: API Documentation
path: docs/doxygen/html/
retention-days: 1
pylint:
name: Pylint check
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- name: Install python packages
run: python3 -m pip install --requirement requirements.txt
- name: Install enchant
run: sudo apt-get update && sudo apt-get -y install python3-enchant
- name: Show versions
run: ./utils/cq/daos_pylint.py --version
- name: Run pylint check.
run: ./utils/cq/daos_pylint.py --git --output-format github
codespell:
name: Codespell
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- name: Install extra python packages
run: python3 -m pip install --requirement utils/cq/requirements.txt
- name: Run check
uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # master
with:
skip: ./src/control/vendor,./src/control/go.sum,./.git,./utils/*.patch
ignore_words_file: ci/codespell.ignores
builtin: clear,rare,informal,names,en-GB_to_en-US
clang-format:
name: Clang Format
runs-on: ubuntu-24.04
steps:
- name: Check out source repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Pull via git
run: git fetch origin ${{ github.event.pull_request.base.ref }}
- name: Get merge-base ref
id: get_merge_base
run: |
ref="$(git merge-base HEAD ${{ github.event.pull_request.base.sha || github.ref }})"
echo "ref=$ref" >> $GITHUB_OUTPUT
- name: Run check in docker
uses: ./.github/actions/clang-format
with:
target: ${{ steps.get_merge_base.outputs.ref }}
- name: Export changes
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: failure()
with:
name: format-patch-for-pr-${{ github.event.pull_request.number }}
path: auto-format-changes.diff
yaml-lint:
name: Yamllint check
runs-on: ubuntu-24.04
steps:
- name: Check out source repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- name: Install extra python packages
run: python3 -m pip install --requirement utils/cq/requirements.txt
- name: Run check
run: yamllint --format github .
copyright:
name: Copyright check
runs-on: ubuntu-24.04
steps:
- name: Check out source repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Run check
run: |
\[ ! -x ./utils/cq/check_update_copyright.sh \] || ./utils/cq/check_update_copyright.sh \
$(git merge-base HEAD ${{ github.event.pull_request.base.sha || github.ref }}) gha
linting-summary:
name: Linting Summary
runs-on: ubuntu-24.04
needs:
- isort
- shell-check
- log-check
- ftest-tags
- flake8-lint
- doxygen
- pylint
- codespell
- clang-format
- yaml-lint
- copyright
if: (!cancelled())
steps:
- name: Check if any job failed
run: |
ALL_DEPS_RESULT='${{ toJSON(needs) }}'
echo "$ALL_DEPS_RESULT" | jq -rc 'keys[] as $k | "\($k):\(.[$k].result)"' \
| while read job_result; do
job_name=$(echo "$job_result" | cut -d: -f1)
job_result=$(echo "$job_result" | cut -d: -f2)
echo "$job_name = $job_result"
if [[ "$job_result" != "success" ]]; then
echo "Job $job_name failed"
exit 1
fi
done