forked from pulp-platform/snitch
-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (229 loc) · 7.25 KB
/
lint.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
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
# Copyright 2020 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# Run all lint checks
name: lint
on: [push, pull_request]
env:
VERIBLE_VERSION: 0.0-807-g10e7c71
jobs:
################
# Verible Lint #
################
verilog:
name: Verilog Sources
# This job runs on Linux (fixed ubuntu version)
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install Verible
run: |
set -e
mkdir -p build/verible
cd build/verible
curl -Ls -o verible.tar.gz https://github.com/google/verible/releases/download/v$VERIBLE_VERSION/verible-v$VERIBLE_VERSION-Ubuntu-18.04-bionic-x86_64.tar.gz
sudo mkdir -p /tools/verible && sudo chmod 777 /tools/verible
tar -C /tools/verible -xf verible.tar.gz --strip-components=1
echo "PATH=$PATH:/tools/verible/bin" >> $GITHUB_ENV
# Run linter in hw/ip subdir
- name: Run Lint
run: |
echo "::add-matcher::.github/verible-lint-matcher.json"
util/verible-lint
echo "::remove-matcher owner=verible-lint-matcher::"
#####################
# Vendor Up-to-Date #
#####################
# Check that all vendored sources are up-to-date.
check-vendor:
name: Vendor Up-to-Date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install requirements
run: pip install -r python-requirements.txt
- name: Re-vendor and diff
run: |
find . \
-name '*.vendor.hjson' \
| xargs -n1 util/vendor.py --verbose \
&& util/git-diff.py --error-msg "::error ::Found differences, please re-vendor."
######################
# Opcodes Up-to-Date #
######################
check-opcodes:
name: Check Opcodes Up-to-Date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Install requirements
run: pip install -r python-requirements.txt
- name: Update opcodes and diff
run: |
./util/generate-opcodes.sh \
&& util/git-diff.py --error-msg "::error ::Found differences, please update all opcodes."
########################
# Check Doc up-to-date #
########################
check-doc:
name: Documentation Up-to-Date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
- run: npm install -g @adobe/[email protected]
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: pip install -r python-requirements.txt
- name: Re-generate documentation and diff
run: |
cd docs/ && rm -r schema-doc && jsonschema2md -d schema/ --out schema-doc -x schema-doc -n
../util/git-diff.py --error-msg "::error ::Found stale documentation, please re-generate schema doc."
#################
# Check License #
#################
licence:
name: Check License
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install requirements
run: pip install -r python-requirements.txt
- name: Check license
run: |
echo "::add-matcher::.github/license-checker-matcher.json"
./util/check-license
echo "::remove-matcher owner=license-checker-matcher::"
####################
# Format YML Files #
####################
yamlfmt:
name: YAML Sources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install requirements
run: pip install -r python-requirements.txt
# Check the proper formatting of all Bender.yml
- name: Check YAML formatting
run: |
util/yml-format
util/git-diff.py --error-msg "::error ::Found differences, run util/yml-format before committing."
########################
# Check Python Sources #
########################
python:
name: Python Sources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install requirements
run: pip install flake8
# Check that all python sources conform to the `pep8` standard
- name: Check Python sources
run: |
echo "::add-matcher::.github/flake8-matcher.json"
flake8
echo "::remove-matcher owner=flake8-matcher::"
######################
# Clang-Format Check #
######################
# Check C/C++ files for correct formatting.
clangfmt:
name: C/C++ Sources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
clangFormatVersion: 10
######################
# Lint Editor Config #
######################
# Detect trailing whitespaces, missing new lines and wrong file encodings.
editorconfig:
name: Editorconfig
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install requirements
run: pip install -r python-requirements.txt
- name: Check files
run: |
echo "::add-matcher::.github/editorconfig-checker-matcher.json"
util/lint-editorconfig
echo "::remove-matcher owner=editorconfig-checker-matcher::"
###########
# Banshee #
###########
Banshee:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- working-directory: sw/banshee
run: cargo fmt --all -- --check
##########
# Occamy #
##########
# Re-generate all files and detect any changes on the generated files.
Occamy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install apt requirements
run: |
sudo apt update
sudo apt install device-tree-compiler clang-format-10
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Install Verible
run: |
set -e
mkdir -p build/verible
cd build/verible
curl -Ls -o verible.tar.gz https://github.com/google/verible/releases/download/v$VERIBLE_VERSION/verible-v$VERIBLE_VERSION-Ubuntu-18.04-bionic-x86_64.tar.gz
sudo mkdir -p /tools/verible && sudo chmod 777 /tools/verible
tar -C /tools/verible -xf verible.tar.gz --strip-components=1
echo "PATH=$PATH:/tools/verible/bin" >> $GITHUB_ENV
- name: Generated Files Up-to-Date
env:
CLANG_FORMAT: clang-format-10
run: |
make -C hw/system/occamy all
util/git-diff.py --error-msg "::error ::Found differences, run \`make -C hw/system/occamy all\` before committing."