-
Notifications
You must be signed in to change notification settings - Fork 1.1k
170 lines (156 loc) · 5.74 KB
/
Copy pathcode_style.yaml
File metadata and controls
170 lines (156 loc) · 5.74 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
name: Code style
"on":
push:
branches:
- main
- ?.*.x
pull_request:
jobs:
cmake_checks:
name: Check CMake files
runs-on: ubuntu-22.04
steps:
- name: Install prerequisites
run: pip install cmakelang
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run format on CMake files
run: |
git reset --hard
find -name CMakeLists.txt -exec cmake-format -i {} +
find src test tsl -name '*.cmake' -exec cmake-format -i {} +
git diff --exit-code
perl_checks:
name: Check Perl code in tree
runs-on: ubuntu-22.04
steps:
- name: Install prerequisites
run: sudo apt install perltidy
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check trailing whitespace
if: always()
run: |
find . -name '*.p[lm]' -exec perl -pi -e 's/[ \t]+$//' {} +
git diff --exit-code
- name: Format Perl files, if needed
if: always()
run: |
git reset --hard
find . -name '*.p[lm]' -exec perltidy -b -bext=/ {} +
git diff --exit-code
yaml_checks:
name: Check YAML code in tree
runs-on: ubuntu-latest
steps:
- name: Install prerequisites
run: |
pip install yamllint
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run yamllint
run: |
find . -type f \( -name "*.yaml" -or -name "*.yml" \) -print -exec yamllint {} \+
spelling_checks:
name: Check spelling
runs-on: ubuntu-latest
steps:
- name: Install prerequisites
run: |
pip install codespell
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run codespell
run: |
find . -type f \( -name "*.c" -or -name "*.h" -or -name "*.yaml" -or -name "*.yml" -or -name "*.sh" -or -name "*.cmake" -or -name "*.py" -or -name "*.pl" -or -name "CMakeLists.txt" \) \
-exec codespell -I .github/codespell-ignore-words {} \+
cc_checks:
name: Check code formatting
runs-on: ubuntu-22.04
strategy:
fail-fast: false
env:
LLVM_VER: 17
steps:
- name: Install Linux Dependencies
timeout-minutes: 15
run: |
gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys 15CF4D18AF4F7421
gpg --batch --export --export-options export-minimal --armor 15CF4D18AF4F7421 | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null
. /etc/os-release
echo "deb https://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-${LLVM_VER} main" | sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null
sudo apt-get update
sudo apt-get install clang-format-${LLVM_VER}
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check trailing whitespace
if: always()
run: |
git reset --hard
find . -type f -regex '.*\.\(c\|h\|sql\|sql\.in\)$' -exec perl -pi -e 's/[ \t]+$//' {} +
git diff --exit-code
- name: Check code formatting
if: always()
run: |
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${LLVM_VER} 100
sudo update-alternatives --set clang-format /usr/bin/clang-format-${LLVM_VER}
git reset --hard
./scripts/clang_format_all.sh
git diff --exit-code
- name: "[F]IXME annotations left in code (use TODO for long-term notes)"
if: always()
run: |
echo '::add-matcher::.github/problem-matchers/grep.json'
! grep '[f]ixme' -niR ./* .github/workflows/*
python_checks:
name: Check Python code in tree
runs-on: ubuntu-latest
steps:
- name: Install prerequisites
run: |
pip install --upgrade pip
pip install black prospector pylint dodgy \
mccabe pycodestyle pyflakes \
psutil pygithub pglast testgres more_itertools
# pinning snowballstemmer to version 2.2.0 due to:
# https://github.com/prospector-dev/prospector/issues/763
pip install --force-reinstall --no-deps snowballstemmer==2.2.0
pip list
pip list --user
- name: Checkout source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run prospector
run: |
git reset --hard
find . -type f -name "*.py" -print -exec prospector {} + -exec black {} +
git diff --exit-code
misc_checks:
name: Check license, update scripts, git hooks, missing gitignore entries and unnecessary template tests
runs-on: ubuntu-24.04
strategy:
fail-fast: false
steps:
- name: Checkout source
if: always()
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check license
if: always()
run: ./scripts/check_license_all.sh
- name: Check git commit hooks
if: always()
run: |
./scripts/githooks/commit_msg_tests.py
- name: Check for unreferenced test files
if: always()
run: ./scripts/check_unreferenced_files.sh
- name: Check for missing gitignore entries for template test files
if: always()
run: |
./bootstrap
./scripts/check_missing_gitignore_for_template_tests.sh
- name: Check for unnecessary template test files
if: always()
run: ./scripts/check_unnecessary_template_tests.sh
- name: Check for orphaned output test files
if: always()
run: ./scripts/check_orphaned_test_output_files.sh