-
Notifications
You must be signed in to change notification settings - Fork 43
315 lines (265 loc) · 11.6 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
name: lint
on:
push:
pull_request:
schedule:
- cron: '34 17 * * *'
jobs:
clang_format_check:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && vars.MMGH_NIGHTLY == 'enable') }}
strategy:
matrix:
path:
- 'cpp'
- 'gtests'
steps:
- uses: actions/checkout@v2
- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: '16'
check-path: ${{ matrix.path }}
fallback-style: 'LLVM' # optional
tidy_flake8_ubuntu:
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && vars.MMGH_NIGHTLY == 'enable') }}
runs-on: ${{ matrix.os }}
env:
JOB_MAKE_ARGS: VERBOSE=1 BUILD_QT=ON USE_CLANG_TIDY=ON LINT_AS_ERRORS=ON
QT_DEBUG_PLUGINS: 1
QT_QPA_PLATFORM: offscreen
# Fix issue: https://github.com/solvcon/modmesh/issues/366
# Use custom config for jurplel/install-qt-action@v4
AQT_CONFIG: "thirdparty/aqt_settings.ini"
strategy:
matrix:
os: [ubuntu-22.04]
cmake_build_type: [Debug]
fail-fast: false
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
- name: dependency by apt
run: |
VERSION_ID=$(bash -c 'source /etc/os-release ; echo $VERSION_ID')
if [ "20.04" == "$VERSION_ID" ] ; then CLANG_TIDY_VERSION=10 ; else CLANG_TIDY_VERSION=14 ; fi
sudo apt-get -qqy update
sudo apt-get -qy install \
sudo curl git build-essential make cmake libc6-dev gcc g++ silversearcher-ag \
clang-tidy-${CLANG_TIDY_VERSION} \
python3 python3-dev python3-venv
sudo ln -fs "$(which clang-tidy-${CLANG_TIDY_VERSION})" "$(dirname $(which clang-tidy-${CLANG_TIDY_VERSION}))/clang-tidy"
# Install qt6 only with ubuntu-22.04
# This page explains why we need libgl1-mesa-dev
# https://doc-snapshots.qt.io/qt6-dev/linux.html
#
# In short, OpenGL libraries and headers are required. Without
# installing this package, cmake won't find the correct lib path.
# This has been replaced by the 'install qt' section below to manage
# qt6 versioning independently from the OS.
# if [ "${{ matrix.os }}" == "ubuntu-22.04" ] ; then \
# sudo apt-get -qy install \
# qt6-3d-dev xvfb \
# libgl1-mesa-dev
# fi
- name: install qt
uses: jurplel/install-qt-action@v4
with:
aqtversion: '==3.1.*'
version: '6.6.3'
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
modules: 'qt3d'
setup-python: 'false'
cache: true
- name: dependency by pip
run: |
sudo pip3 install setuptools
sudo pip3 install numpy pytest flake8 jsonschema pyside6==$(qmake6 -query QT_VERSION)
- name: dependency (manual)
run: sudo ${GITHUB_WORKSPACE}/contrib/dependency/install.sh pybind11
- name: show dependency
# Copy the commands from contrib/dependency/showdep.sh
run: |
echo "gcc path: $(which gcc)"
echo "gcc version: $(gcc --version)"
echo "cmake path: $(which cmake)"
echo "cmake version: $(cmake --version)"
echo "python3 path: $(which python3)"
echo "python3 version: $(python3 --version)"
echo "python3-config --prefix: $(python3-config --prefix)"
echo "python3-config --exec-prefix: $(python3-config --exec-prefix)"
echo "python3-config --includes: $(python3-config --includes)"
echo "python3-config --libs: $(python3-config --libs)"
echo "python3-config --cflags: $(python3-config --cflags)"
echo "python3-config --ldflags: $(python3-config --ldflags)"
echo "pip3 path: $(which pip3)"
python3 -c 'import numpy as np; print("np.__version__:", np.__version__, np.get_include())'
echo "pytest path: $(which pytest)"
echo "pytest version: $(pytest --version)"
echo "clang-tidy path: $(which clang-tidy)"
echo "clang-tidy version: $(clang-tidy -version)"
echo "flake8 path: $(which flake8)"
echo "flake8 version: $(flake8 --version)"
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}-tidy-${{ matrix.cmake_build_type }}
restore-keys: ${{ runner.os }}-tidy-${{ matrix.cmake_build_type }}
create-symlink: true
- name: make cinclude (check_include)
run: make cinclude
- name: make viewer
run: |
make viewer \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DUSE_PYTEST_HELPER_BINDING=ON"
- name: make run_viewer_pytest
run: |
export LD_LIBRARY_PATH=$(python3 -c "import sys, os, shiboken6; sys.stdout.write(os.path.dirname(shiboken6.__file__))")
make run_viewer_pytest \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DUSE_PYTEST_HELPER_BINDING=ON"
- name: make flake8
run: |
make flake8 \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3)"
tidy_flake8_macos:
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && vars.MMGH_NIGHTLY == 'enable') }}
runs-on: ${{ matrix.os }}
env:
JOB_MAKE_ARGS: VERBOSE=1 BUILD_QT=ON USE_CLANG_TIDY=ON LINT_AS_ERRORS=ON
QT_DEBUG_PLUGINS: 1
PIP_BREAK_SYSTEM_PACKAGES: 1 # disabling PEP668
# Fix issue: https://github.com/solvcon/modmesh/issues/366
# Use custom config for jurplel/install-qt-action@v4
AQT_CONFIG: "thirdparty/aqt_settings.ini"
strategy:
matrix:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
# 20240811: clang-tidy (llvm@16) runs extremely slowly on macos-14
# (i.e., macos-14-arm64), but not macos-13. Temporarily turn off the
# linter run on macos-14 and revisit in the future.
#os: [macos-13, macos-14]
os: [macos-13]
cmake_build_type: [Debug]
fail-fast: false
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
# Some mac runner does not have /usr/local/include and cmake sometimes crashes
sudo mkdir -p /usr/local/include
- name: dependency by homebrew
run: |
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
# This has been replaced by the 'install qt' section below to manage
# qt6 versioning independently from the OS.
# brew install llvm@16 qt6
brew install llvm@16
ln -s "$(brew --prefix llvm@16)/bin/clang-format" "/usr/local/bin/clang-format"
ln -s "$(brew --prefix llvm@16)/bin/clang-tidy" "/usr/local/bin/clang-tidy"
- name: install qt
uses: jurplel/install-qt-action@v4
with:
aqtversion: '==3.1.*'
version: '6.6.3'
host: 'mac'
target: 'desktop'
arch: 'clang_64'
modules: 'qt3d'
setup-python: 'false'
cache: true
- name: dependency by pip
run: |
echo "which python3: $(which python3)"
ls -al $(which python3)
if [ "${{ matrix.os }}" == "macos-13" ] || [ "${{ matrix.os }}" == "macos-14" ] ; then
# suppress the warning of pip because brew forces PEP668 since python3.12
python3 -m pip -v install --upgrade setuptools --break-system-packages
python3 -m pip -v install --upgrade pip --break-system-packages
python3 -m pip -v install --upgrade numpy pytest flake8 jsonschema pyside6==$(qmake -query QT_VERSION) --break-system-packages
else
python3 -m pip -v install --upgrade setuptools
python3 -m pip -v install --upgrade pip
python3 -m pip -v install --upgrade numpy pytest flake8 jsonschema pyside6==$(qmake -query QT_VERSION)
fi
- name: dependency (manual)
run: sudo NO_INSTALL_PREFIX=1 ${GITHUB_WORKSPACE}/contrib/dependency/install.sh pybind11
- name: show dependency
# Copy the commands from contrib/dependency/showdep.sh
run: |
echo "gcc path: $(which gcc)"
echo "gcc version: $(gcc --version)"
echo "cmake path: $(which cmake)"
echo "cmake version: $(cmake --version)"
echo "python3 path: $(which python3)"
echo "python3 version: $(python3 --version)"
echo "python3-config --prefix: $(python3-config --prefix)"
echo "python3-config --exec-prefix: $(python3-config --exec-prefix)"
echo "python3-config --includes: $(python3-config --includes)"
echo "python3-config --libs: $(python3-config --libs)"
echo "python3-config --cflags: $(python3-config --cflags)"
echo "python3-config --ldflags: $(python3-config --ldflags)"
echo "pip3 path: $(which pip3)"
python3 -c 'import numpy as np; print("np.__version__:", np.__version__, np.get_include())'
echo "pytest path: $(which pytest)"
echo "pytest version: $(pytest --version)"
echo "clang-tidy path: $(which clang-tidy)"
echo "clang-tidy version: $(clang-tidy -version)"
echo "flake8 path: $(which flake8)"
echo "flake8 version: $(flake8 --version)"
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}-tidy-${{ matrix.cmake_build_type }}
restore-keys: ${{ runner.os }}-tidy-${{ matrix.cmake_build_type }}
create-symlink: true
- name: make cinclude (check_include)
run: make cinclude
- name: make viewer USE_PYTEST_HELPER_BINDING=OFF
run: |
make viewer \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DUSE_PYTEST_HELPER_BINDING=ON"
- name: make viewer USE_PYTEST_HELPER_BINDING=ON
run: |
rm -f build/*/Makefile
make viewer \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DUSE_PYTEST_HELPER_BINDING=ON"
- name: make run_viewer_pytest
run: |
# PySide6 installed by pip will bundle with a prebuilt Qt,
# this will cause duplicated symbol.
# Solve this issue by removed PySide6 prebuilt Qt library
rm -rf $(python3 -c "import sys, os, PySide6; sys.stdout.write(os.path.dirname(PySide6.__file__))")/Qt/lib/*.framework
make run_viewer_pytest \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3)"
- name: make flake8
run: |
make flake8 \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3)"