1+ # Now it is separated to avoid affecting MPICH is not compatible with Ubuntu-latest and bear is not compatible with OPENMPI. This workflow should be merged after either compatibility issue is resolved.
2+ name : Clang-Tidy Check
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - develop
8+ pull_request :
9+ branches :
10+ - main
11+ - develop
12+
13+ jobs :
14+ clang-tidy-check :
15+ runs-on : ubuntu-latest
16+
17+ defaults :
18+ run :
19+ shell : bash
20+
21+ strategy :
22+ matrix :
23+ build_type : [Release]
24+ memory_test : [ON, OFF]
25+ compiler : [g++]
26+ language : ['cpp']
27+ exclude :
28+ - build_type : Release
29+ memory_test : ON
30+ - build_type : RelWithDebInfo
31+ memory_test : OFF
32+
33+ steps :
34+
35+ - name : Update packages
36+ run : sudo apt-get update
37+
38+ - name : Install mpich
39+ run : sudo apt-get install -yq libmpich-dev mpich
40+
41+ - name : Install cmake
42+ run : sudo apt-get install -yq cmake
43+
44+ - uses : actions/checkout@v4
45+
46+ - name : build Catch2
47+ uses : ./.github/actions/install-repo
48+ with :
49+ repo-name : ' Catch2-openmpi'
50+ repo-path : ' catchorg/Catch2'
51+ repo-ref : ' '
52+ cache : true
53+
54+ - name : build kokkos
55+ uses : ./.github/actions/install-repo
56+ with :
57+ repo-name : ' kokkos-openmpi'
58+ repo-path : ' kokkos/kokkos'
59+ repo-ref : ' 4.6.01'
60+ cache : true
61+ options : ' -DCMAKE_CXX_STANDARD=17
62+ -DBUILD_SHARED_LIBS=OFF
63+ -DKokkos_ENABLE_SERIAL=ON
64+ -DKokkos_ENABLE_OPENMP=OFF
65+ -DKokkos_ENABLE_CUDA=OFF
66+ -DKokkos_ENABLE_CUDA_LAMBDA=OFF
67+ -DKokkos_ENABLE_CUDA_CONSTEXPR=OFF'
68+
69+ - name : build kokkos-kernels
70+ uses : ./.github/actions/install-repo
71+ with :
72+ repo-name : ' kokkos-kernels-openmpi'
73+ repo-path : ' kokkos/kokkos-kernels'
74+ repo-ref : ' 4.6.01'
75+ cache : true
76+ options : ' -DCMAKE_CXX_STANDARD=17
77+ -DBUILD_SHARED_LIBS=OFF
78+ -DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos'
79+
80+ - name : build omega_h
81+ uses : ./.github/actions/install-repo
82+ with :
83+ repo-name : ' omega_h-openmpi'
84+ repo-path : ' SCOREC/omega_h'
85+ repo-ref : ' '
86+ cache : true
87+ options : ' -DCMAKE_CXX_COMPILER=`which mpicxx`
88+ -DCMAKE_C_COMPILER=`which mpicc`
89+ -DBUILD_SHARED_LIBS=OFF
90+ -DOmega_h_USE_MPI=ON
91+ -DOmega_h_USE_Kokkos=ON
92+ -DBUILD_TESTING=OFF
93+ -DMPIEXEC_EXECUTABLE=`which mpirun`
94+ -DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos'
95+
96+ - name : build meshFields
97+ uses : ./.github/actions/install-repo
98+ with :
99+ repo-name : ' meshFields-openmpi'
100+ repo-path : ' SCOREC/meshFields'
101+ repo-ref : ' '
102+ cache : true
103+ options : ' -DCMAKE_CXX_COMPILER=`which mpicxx`
104+ -DCMAKE_C_COMPILER=`which mpicc`
105+ -DMPIEXEC_EXECUTABLE=`which mpirun`
106+ -DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos
107+ -DOmega_h_DIR=${{ runner.temp }}/build-omega_h-openmpi/install/lib/cmake/Omega_h'
108+
109+ - name : build perfstubs
110+ uses : ./.github/actions/install-repo
111+ with :
112+ repo-name : ' perfstubs-openmpi'
113+ repo-path : ' UO-OACISS/perfstubs'
114+ repo-ref : ' '
115+ cache : true
116+ options : ' -DCMAKE_CXX_COMPILER=mpicxx'
117+
118+ - name : build kokkos-fortran-interop
119+ uses : ./.github/actions/install-repo
120+ with :
121+ repo-name : ' kokkos-fortran-interop-openmpi'
122+ repo-path : ' kokkos/kokkos-fortran-interop'
123+ repo-ref : ' '
124+ cache : true
125+ options : ' -DCMAKE_BUILD_TYPE=Release
126+ -DCMAKE_CXX_COMPILER=`which mpicxx`
127+ -DCMAKE_C_COMPILER=`which mpicc`
128+ -DCMAKE_Fortran_COMPILER=`which mpifort`
129+ -DBUILD_TESTING=OFF
130+ -DFLCL_BUILD_TESTS=OFF
131+ -DFLCL_BUILD_EXAMPLE=OFF
132+ -DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos'
133+
134+ - name : build ADIOS2
135+ uses : ./.github/actions/install-repo
136+ with :
137+ repo-name : ' ADIOS2-openmpi'
138+ repo-path : ' ornladios/ADIOS2'
139+ repo-ref : ' '
140+ cache : true
141+ options : ' -DADIOS2_USE_CUDA=OFF'
142+
143+ - name : build redev
144+ uses : ./.github/actions/install-repo
145+ with :
146+ repo-name : ' redev-openmpi'
147+ repo-path : ' SCOREC/redev'
148+ repo-ref : ' '
149+ cache : true
150+ options : ' -DCMAKE_CXX_COMPILER=`which mpicxx`
151+ -DMPIEXEC_EXECUTABLE=`which mpirun`
152+ -DCMAKE_BUILD_TYPE=Release
153+ -DBUILD_SHARED_LIBS=OFF
154+ -DADIOS2_DIR=${{ runner.temp }}/build-ADIOS2-openmpi/install/lib/cmake/adios2
155+ -Dperfstubs_DIR=${{ runner.temp }}/build-perfstubs-openmpi/install/lib/cmake'
156+
157+ - name : checkout pcms_testcases
158+ uses : actions/checkout@v3
159+ with :
160+ repository : jacobmerson/pcms_testcases
161+ path : pcms_testcases
162+
163+ - name : Install fftw3
164+ run : sudo apt-get install -yq libfftw3-dev pkg-config
165+
166+ - name : Install Bear
167+ run : sudo apt-get install -yq bear
168+
169+ - name : configure pcms
170+ run : |
171+ mkdir ${{ runner.temp }}/build-pcms
172+ cmake -S . -B ${{ runner.temp }}/build-pcms -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
173+ -DCMAKE_C_COMPILER=mpicc \
174+ -DCMAKE_CXX_COMPILER=mpicxx \
175+ -DCMAKE_Fortran_COMPILER=mpifort \
176+ -DPCMS_TIMEOUT=10 \
177+ -DCatch2_DIR=${{ runner.temp }}/build-Catch2-openmpi/install/lib/cmake/Catch2 \
178+ -DOmega_h_DIR=${{ runner.temp }}/build-omega_h-openmpi/install/lib/cmake/Omega_h \
179+ -Dmeshfields_DIR=${{ runner.temp }}/build-meshFields-openmpi/install/lib/cmake/meshfields \
180+ -Dredev_DIR=${{ runner.temp }}/build-redev-openmpi/install/lib/cmake/redev \
181+ -Dflcl_DIR=${{ runner.temp }}/build-kokkos-fortran-interop-openmpi/install/lib/cmake/flcl \
182+ -DMPIEXEC_EXECUTABLE=mpirun \
183+ -DADIOS2_DIR=${{ runner.temp }}/build-ADIOS2-openmpi/install/lib/cmake/adios2 \
184+ -Dperfstubs_DIR=${{ runner.temp }}/build-perfstubs-openmpi/install/lib/cmake \
185+ -DKokkos_DIR=${{ runner.temp }}/build-kokkos-openmpi/install/lib/cmake/Kokkos \
186+ -DKokkosKernels_DIR=${{ runner.temp }}/build-kokkos-kernels-openmpi/install/lib/cmake/KokkosKernels/ \
187+ -DPCMS_TEST_DATA_DIR=$PWD/pcms_testcases
188+
189+ - name : Configure pcms with Bear
190+ run : |
191+ cd ${{ runner.temp }}/build-pcms
192+ bear -- make
193+
194+ - name : Install clang-tidy
195+ run : |
196+ sudo apt-get update
197+ sudo apt-get install -yq clang-tidy-18
198+
199+ - name : Run clang-tidy
200+ run : |
201+ EXIT_CODE=0
202+ while read file; do
203+ if ! clang-tidy -p ${{ runner.temp }}/build-pcms "$file" --quiet; then
204+ echo "$file has clang-tidy issues"
205+ EXIT_CODE=1
206+ fi
207+ done < <(find src -name "*.cpp" -o -name "*.hpp" -o -name "*.c" -o -name "*.h" -o -name "*.cc" -o -name "*.cxx" | grep -v 'src/pcms/capi/' | grep -v 'src/pcms/fortranapi/')
208+ if [ $EXIT_CODE -eq 1 ]; then
209+ echo "Some C/C++ files have clang-tidy issues. Please fix them with clang-tidy-18."
210+ exit 1
211+ fi
212+ echo "All C/C++ files pass clang-tidy checks"
0 commit comments