-
Notifications
You must be signed in to change notification settings - Fork 46
74 lines (69 loc) · 2.09 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
# Copyright 2021 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# Lint the design
name: lint
on: [push, pull_request]
jobs:
#################
# Check License #
#################
check-license:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Python requirements
run: pip install -r python-requirements.txt
- name: Check license
run: python scripts/license-checker.py --config scripts/license-checker.hjson
######################
# Clang-Format Check #
######################
# Check C/C++ files for correct formatting.
clangfmt:
name: C/C++ Sources
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.14
with:
clangFormatVersion: 14
########################
# Check Python Sources #
########################
python:
name: Python Sources
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install Python requirements
run: pip install flake8
# Check that all python sources conform to the `pep8` standard
- name: Check Python sources
run: |
flake8
#########################
# Check Trailing Spaces #
#########################
check-trailing-whitespaces:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine base commit
run: |
if [[ -n $GITHUB_BASE_REF ]]; then
# Make sure we have the latest version of the target branch
git fetch origin $GITHUB_BASE_REF
echo "base=origin/$GITHUB_BASE_REF" >> $GITHUB_ENV
else
echo "base=HEAD~1" >> $GITHUB_ENV
fi
- name: Check for trailing whitespaces and tabs
run: |
git diff --check $base HEAD -- \
':(exclude)**.def' \
':(exclude)**.patch' \
':(exclude)toolchain/**' \
':(exclude)software/riscv-tests/**'