-
Notifications
You must be signed in to change notification settings - Fork 301
162 lines (152 loc) · 5.9 KB
/
linting.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
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
name: Linting
# Always run on Pull Requests as then these checks can be marked as required.
on:
push:
branches:
- master
- 'feature/*'
- 'release/*'
pull_request:
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:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3'
- uses: isort/isort-action@master
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-22.04
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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-22.04
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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-22.04
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Check DAOS ftest tags.
run: \[ ! -x src/tests/ftest/tags.py \] || ./src/tests/ftest/tags.py lint
flake8-lint:
runs-on: ubuntu-22.04
name: Flake8 check
steps:
- name: Check out source repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3'
- 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-22.04
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: API Documentation
path: docs/doxygen/html/
retention-days: 1
pylint:
name: Pylint check
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.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-22.04
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install extra python packages
run: pip install --requirement utils/cq/requirements.txt
- name: Run check
uses: codespell-project/actions-codespell@3174815d6231f5bdc24dbfb6fc3b8caec73d521c # master
with:
skip: ./src/control/vendor,./src/control/go.sum,./.git
ignore_words_file: ci/codespell.ignores
builtin: clear,rare,informal,names,en-GB_to_en-US