-
Notifications
You must be signed in to change notification settings - Fork 1
344 lines (293 loc) · 11.2 KB
/
tidy.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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
name: Static Analysis
on: pull_request
env:
CMAKE_VERSION: 3.21.1
NINJA_VERSION: 1.10.2
CCACHE_VERSION: 4.4
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
env:
BUILD_TYPE: ${{ matrix.config.buildtype }}
BUILD_FLAGS: ${{ matrix.config.buildflags}}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Latest Clang", artifact: "Linux.tar.xz",
os: ubuntu-latest,
cc: "clang", cxx: "clang++",
buildtype: "Debug",
buildflags: "-fno-openmp",
}
steps:
- name: Clone MISO
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Download Ninja
id: cmake_and_ninja
shell: cmake -P {0}
run: |
set(cmake_version $ENV{CMAKE_VERSION})
set(ninja_version $ENV{NINJA_VERSION})
message(STATUS "Using host CMake version: ${CMAKE_VERSION}")
if ("${{ runner.os }}" STREQUAL "Linux")
set(ninja_suffix "linux.zip")
set(cmake_suffix "linux-x86_64.tar.gz")
set(cmake_dir "cmake-${cmake_version}-linux-x86_64/bin")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(ninja_suffix "mac.zip")
set(cmake_suffix "macos-universal.tar.gz")
set(cmake_dir "cmake-${cmake_version}-macos-universal/CMake.app/Contents/bin")
endif()
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}")
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip)
set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}")
file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip)
# Add to PATH environment variable
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir)
set(path_separator ":")
file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${cmake_dir}")
execute_process(
COMMAND chmod +x ninja
COMMAND chmod +x ${cmake_dir}/cmake
)
- name: Download clang-tidy
id: cland-tidy-download
run: sudo apt-get install clang-tidy
- name: Download OpenMPI
id: openmpi
run: sudo apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
- name: Download Metis
id: metis
run: brew install metis
# run: sudo apt-get install metis libmetis-dev
- name: Download ccache
id: ccache
# run: sudo apt-get install ccache
run: brew install ccache
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: ccache cache files
uses: actions/[email protected]
with:
path: .ccache
key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.config.name }}-ccache-
- name: Download Adept
uses: actions/checkout@v2
with:
repository: 'rjhogan/Adept-2'
path: .deps/adept
- name: Configure Adept
run: |
cd ${GITHUB_WORKSPACE}/.deps/adept/
autoreconf -i
./configure --prefix="${GITHUB_WORKSPACE}/.deps/adept/install" \
--with-blas=blas \
--with-lapack=lapack \
--disable-openmp \
CC="ccache ${{matrix.config.cc}}" \
CXX="ccache ${{matrix.config.cxx}}" \
- name: Build Adept
run: |
cd ${GITHUB_WORKSPACE}/.deps/adept/
CC="ccache ${{matrix.config.cc}}" CXX="ccache ${{matrix.config.cxx}}" make -j 2
# CC="ccache ${{matrix.config.cc}}" CXX="ccache ${{matrix.config.cxx}}" make check
make install
- name: Download Hypre
uses: actions/checkout@v2
with:
repository: 'hypre-space/hypre'
ref: 'v2.20.0'
path: .deps/hypre
- name: Create Hypre Build Environment
run: cmake -E make_directory ${GITHUB_WORKSPACE}/.deps/hypre/src/build
- name: Configure Hypre
shell: cmake -P {0}
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
set(path_separator ":")
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
execute_process(
COMMAND cmake
-S $ENV{GITHUB_WORKSPACE}/.deps/hypre/src
-B $ENV{GITHUB_WORKSPACE}/.deps/hypre/src/build
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
-G Ninja
-D CMAKE_MAKE_PROGRAM=ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_POSITION_INDEPENDENT_CODE=ON
-D CMAKE_INSTALL_PREFIX=.
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build Hypre
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir)
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}")
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
set(ENV{CCACHE_COMPRESS} "true")
set(ENV{CCACHE_COMPRESSLEVEL} "6")
set(ENV{CCACHE_MAXSIZE} "1000M")
if ("${{ matrix.config.cxx }}" STREQUAL "cl")
set(ENV{CCACHE_MAXSIZE} "1000M")
endif()
execute_process(COMMAND ccache -p)
execute_process(COMMAND ccache -z)
execute_process(
COMMAND cmake --build $ENV{GITHUB_WORKSPACE}/.deps/hypre/src/build
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE
)
if (NOT result EQUAL 0)
string(REGEX MATCH "FAILED:.*$" error_message "${output}")
string(REPLACE "\n" "%0A" error_message "${error_message}")
message("::error::${error_message}")
message(FATAL_ERROR "Build failed")
endif()
- name: Install Hypre
run: cmake --build ${GITHUB_WORKSPACE}/.deps/hypre/src/build --config $BUILD_TYPE --target install
- name: Download MFEM
uses: actions/checkout@v2
with:
repository: 'mfem/mfem'
ref: 'odl-next'
path: .deps/mfem
- name: Create MFEM Build Environment
run: cmake -E make_directory ${GITHUB_WORKSPACE}/.deps/mfem/build
- name: Configure MFEM
shell: cmake -P {0}
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
set(path_separator ":")
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
execute_process(
COMMAND brew --prefix metis
OUTPUT_VARIABLE metis-dir
)
execute_process(
COMMAND cmake
-S $ENV{GITHUB_WORKSPACE}/.deps/mfem/
-B $ENV{GITHUB_WORKSPACE}/.deps/mfem/build
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
-G Ninja
-D CMAKE_MAKE_PROGRAM=ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_POSITION_INDEPENDENT_CODE=ON
-D MFEM_USE_MPI=YES
-D MFEM_USE_METIS_5=YES
-D HYPRE_DIR=../hypre
-D METIS_DIR=/home/linuxbrew/.linuxbrew/opt/metis
-D MFEM_ENABLE_EXAMPLES=NO
-D MFEM_ENABLE_MINIAPPS=NO
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build MFEM
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir)
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}")
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
set(ENV{CCACHE_COMPRESS} "true")
set(ENV{CCACHE_COMPRESSLEVEL} "6")
set(ENV{CCACHE_MAXSIZE} "1000M")
if ("${{ matrix.config.cxx }}" STREQUAL "cl")
set(ENV{CCACHE_MAXSIZE} "1000M")
endif()
# execute_process(COMMAND ccache -p)
# execute_process(COMMAND ccache -z)
execute_process(
COMMAND cmake --build $ENV{GITHUB_WORKSPACE}/.deps/mfem/build
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE
)
if (NOT result EQUAL 0)
string(REGEX MATCH "FAILED:.*$" error_message "${output}")
string(REPLACE "\n" "%0A" error_message "${error_message}")
message("::error::${error_message}")
message(FATAL_ERROR "Build failed")
endif()
# - name: Clone MISO
# uses: actions/checkout@v2
# with:
# # path: miso
# fetch-depth: 2
- name: Create MISO Build Environment
run: cmake -E make_directory ${GITHUB_WORKSPACE}/build
- name: Generate Compile Commands
shell: cmake -P {0}
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
set(path_separator ":")
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
execute_process(
COMMAND cmake
-S .
-B build
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
-G Ninja
-D CMAKE_MAKE_PROGRAM=ninja
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_POSITION_INDEPENDENT_CODE=ON
-D CMAKE_CXX_FLAGS="$ENV{BUILD_FLAGS}"
-D Adept_ROOT=$ENV{GITHUB_WORKSPACE}/.deps/adept/install
-D MFEM_DIR=$ENV{GITHUB_WORKSPACE}/.deps/mfem/build
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Run clang-tidy
run: |
git diff -U0 HEAD^ | clang-tidy-diff -p1 -path build/compile_commands.json -export-fixes build/fixes.yml
- name: Run clang-tidy-pr-comments action
uses: platisd/clang-tidy-pr-comments@master
with:
# The GitHub token (or a personal access token)
github_token: ${{ secrets.GITHUB_TOKEN }}
# The path to the clang-tidy fixes generated previously
clang_tidy_fixes: build/fixes.yml
# Optionally set to true if you want the Action to request
# changes in case warnings are found
request_changes: true
# Optionally set the number of comments per review
# to avoid GitHub API timeouts for heavily loaded
# pull requests
suggestions_per_comment: 25
- name: ccache statistics
shell: cmake -P {0}
run: |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir)
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}")
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
execute_process(COMMAND ccache -s)