-
Notifications
You must be signed in to change notification settings - Fork 8
120 lines (115 loc) · 4.48 KB
/
style.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
name: Style Checks
on: [push, pull_request, workflow_dispatch]
jobs:
clang-format:
name: Formatting Check (C/C++)
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Run CMake to generate compilation database
run: |
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DTOOLCHAIN=x86 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: 'file' # Use .clang-format config file
tidy-checks: '' # Use .clang-tidy config file
# only 'update' a single comment in a pull request's thread.
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
database: 'build'
step-summary: true
# - name: Run clang-format style check for C/C++ programs.
# uses: jidicula/[email protected]
# with:
# clang-format-version: '13'
# check-path: ${{ matrix.path }}
# - name: Check for changes
# run: |
# git status
cmake-format:
name: Formatting Check (CMake)
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Format CMake files
id: cmake-format
uses: PuneetMatharu/[email protected]
with:
# Arguments to be passed to cmake-format.
#
# Options:
# -h, --help show this help message and exit
# -v, --version show program's version number and exit
# -l {error,warning,info,debug}, --log-level {error,warning,info,debug}
# --dump-config [{yaml,json,python}]
# If specified, print the default configuration to stdout and exit
# --dump {lex,parse,parsedb,layout,markup}
# --no-help When used with --dump-config, will omit helptext comments in the output
# --no-default When used with --dump-config, will omit any unmodified configuration value.
# -i, --in-place
# --check Exit with status code 0 if formatting would not change file contents, or status code 1 if it would
# -o OUTFILE_PATH, --outfile-path OUTFILE_PATH
# Where to write the formatted file. Default is stdout.
# -c CONFIG_FILES [CONFIG_FILES ...], --config-files CONFIG_FILES [CONFIG_FILES ...]
# path to configuration file(s)
args: --config-files .cmake-format.yaml --check
- name: Check for changes
run: |
git status
python-format:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
# - uses: psf/black@stable
# with:
# options: "--check --verbose --preview -l 120"
# version: "~= 24.8"
# - name: Check for changes
# run: |
# git status
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Python dependencies
run: pip install black flake8
- name: Run linters
uses: wearerequired/lint-action@v1
with:
black: true
flake8: true
shell-format:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Run ShellCheck
uses: azohra/shell-linter@latest
- name: Check for changes
run: |
git status
license-check:
name: Check for License headers
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Python dependencies
run: pip install licenseheaders
- name: Download template file
run: wget https://raw.githubusercontent.com/johann-petrak/licenseheaders/master/templates/apache-2.tmpl
- name: Run check
run: |
licenseheaders -t apache-2.tmpl -y "${YEARS}" -o "${OWNER}" -n "${PROJECT}" -u "${URL}" -d . -E "${EXTENSIONS}"
test -z "$(git status --untracked-files=no --porcelain)" || (echo "Please check your license headers!" ; git status --untracked-files=no --porcelain ; false) && echo "License check was successful."
env:
OWNER: "TUM Department of Electrical and Computer Engineering"
PROJECT: "muRISCV-NN"
YEARS: "2023"
URL: "https://github.com/tum-ei-eda/muriscv-nn.git"
EXTENSIONS: "py cmake yml sh md"