-
Notifications
You must be signed in to change notification settings - Fork 5
239 lines (236 loc) · 8.58 KB
/
ci.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
name: TIOGA CI
on:
push:
branches:
- exawind
pull_request:
branches:
- exawind
concurrency:
group: ${{github.ref}}-${{github.head_ref}}-ci
cancel-in-progress: true
jobs:
Formatting:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Check formatting
uses: DoozyX/[email protected]
with:
source: './src'
exclude: '.'
extensions: 'h,cpp'
clangFormatVersion: 16
CPU:
needs: Formatting
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Release, Debug]
include:
- os: macos-latest
install_deps: brew install mpich ccache
comp: llvm
procs: $(sysctl -n hw.ncpu)
ccache_cache: /Users/runner/Library/Caches/ccache
ccache_size: 50M
- os: ubuntu-latest
install_deps: sudo apt-get install -y mpich libmpich-dev
comp: gnu
procs: $(nproc)
ccache_cache: ~/.cache/ccache
ccache_size: 50M
steps:
- name: Clone
uses: actions/checkout@v4
with:
submodules: true
- name: Dependencies
run: ${{matrix.install_deps}}
- name: Setup
run: |
echo "NPROCS=${{matrix.procs}}" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=1" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=1" >> $GITHUB_ENV
echo "CCACHE_LOGFILE=${{github.workspace}}/ccache.log.txt" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=${{matrix.ccache_size}}" >> $GITHUB_ENV
- name: Install Ccache
run: |
if [ "${RUNNER_OS}" != "macOS" ]; then
wget https://github.com/ccache/ccache/releases/download/v4.8/ccache-4.8-linux-x86_64.tar.xz
tar xvf ccache-4.8-linux-x86_64.tar.xz
sudo cp -f ccache-4.8-linux-x86_64/ccache /usr/local/bin/
fi
- name: Set Up Ccache
uses: actions/cache@v4
with:
path: ${{matrix.ccache_cache}}
key: ccache-${{github.workflow}}-${{github.job}}-${{matrix.os}}-${{matrix.build_type}}-git-${{github.sha}}
restore-keys: |
ccache-${{github.workflow}}-${{github.job}}-${{matrix.os}}-${{matrix.build_type}}-git-
- name: Configure
run: |
cmake -B ${{runner.workspace}}/build-ci-${{matrix.build_type}} \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-${{matrix.build_type}} \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
${{github.workspace}}
- name: Build
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
ccache -z
set -eu -o pipefail
cmake --build ${{runner.workspace}}/build-ci-${{matrix.build_type}} --parallel ${{env.NPROCS}} 2>&1 | \
tee -a ${{runner.workspace}}/build-ci-${{matrix.build_type}}/build-output.txt
- name: Ccache Report
run: |
ccache -s
ls ${{matrix.ccache_cache}}
du -hs ${{matrix.ccache_cache}}
- name: Report
working-directory: ${{runner.workspace}}/build-ci-${{matrix.build_type}}
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
egrep "warning:|error:" build-output.txt | egrep -v "submods" \
| egrep -v "ld: warning:" | egrep -v "lto-wrapper: warning:" | sort | uniq \
| awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > build-output-warnings.txt
cat build-output-warnings.txt
exit $(tail -n 1 build-output-warnings.txt | awk '{print $2}')
Lint-clang-tidy:
needs: Formatting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
with:
submodules: true
- name: Setup
run: |
echo "NPROCS=$(nproc)" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=1" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=1" >> $GITHUB_ENV
echo "CCACHE_LOGFILE=${{github.workspace}}/ccache.log.txt" >> $GITHUB_ENV
echo "CCACHE_EXTRAFILES=${{github.workspace}}/.clang-tidy" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=50M" >> $GITHUB_ENV
echo "CTCACHE_DIR=~/.cache/ctcache" >> $GITHUB_ENV
- name: Install Ccache
run: |
wget https://github.com/ccache/ccache/releases/download/v4.8/ccache-4.8-linux-x86_64.tar.xz
sudo curl https://raw.githubusercontent.com/matus-chochlik/ctcache/7fd516e91c17779cbc6fc18bd119313d9532dd90/clang-tidy-cache -Lo /usr/bin/clang-tidy-cache
tar xvf ccache-4.8-linux-x86_64.tar.xz
sudo cp -f ccache-4.8-linux-x86_64/ccache /usr/local/bin/
sudo chmod +x /usr/bin/clang-tidy-cache
mkdir -p ~/.cache/ctcache
- name: Set Up Ccache
uses: actions/cache@v4
with:
path: ~/.cache
key: ccache-${{github.workflow}}-${{github.job}}-git-${{github.sha}}
restore-keys: |
ccache-${{github.workflow}}-${{github.job}}-git-
- name: Dependencies
run: sudo apt-get install -y mpich libmpich-dev
- name: Configure
run: |
export MPICH_CXX=$(which clang++)
export MPICH_CC=$(which clang)
cmake \
-B ${{runner.workspace}}/build-clang-tidy \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_CXX_COMPILER:STRING=mpicxx \
-DCMAKE_C_COMPILER:STRING=mpicc \
-DTIOGA_ENABLE_CLANG_TIDY:BOOL=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
${{github.workspace}}
- name: Check
working-directory: ${{runner.workspace}}/build-clang-tidy
run: |
cmake --build . --parallel ${{env.NPROCS}} 2>&1 | tee -a clang-tidy-full-report.txt
cat clang-tidy-full-report.txt | grep "warning:" | grep -v "submods" | sort | uniq | \
awk 'BEGIN{i=0}{print $0}{i++}END{print "Warnings: "i}' > clang-tidy-ci-report.txt
- name: Ccache Report
run: |
ls ~/.cache
ls ~/.cache/ccache
du -hs ~/.cache/ccache
ls ~/.cache/ctcache
du -hs ~/.cache/ctcache
ccache -s
- name: Full report
working-directory: ${{runner.workspace}}/build-clang-tidy
run: cat clang-tidy-full-report.txt
- name: Short report
working-directory: ${{runner.workspace}}/build-clang-tidy
run: |
echo "::add-matcher::.github/problem-matchers/gcc.json"
cat clang-tidy-ci-report.txt
exit $(tail -n 1 clang-tidy-ci-report.txt | awk '{print $2}')
Lint-codeql:
needs: Formatting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
with:
submodules: true
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
queries: +security-and-quality
config-file: ./.github/codeql/codeql-config.yml
- name: Dependencies
run: sudo apt-get install -y mpich libmpich-dev
- name: Configure
run: |
echo "NPROCS=$(nproc)" >> $GITHUB_ENV
export MPICH_CXX=$(which clang++)
export MPICH_CC=$(which clang)
cmake \
-B ${{runner.workspace}}/build-ci-codeql \
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-codeql \
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER:STRING=mpicxx \
-DCMAKE_C_COMPILER:STRING=mpicc \
${{github.workspace}}
- name: Build
run: |
cmake --build ${{runner.workspace}}/build-ci-codeql --parallel ${{env.NPROCS}}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:cpp"
upload: False
output: sarif-results
- name: Filter CodeQL sarif
uses: advanced-security/filter-sarif@v1
with:
patterns: |
-**/submods/**
input: sarif-results/cpp.sarif
output: sarif-results/cpp.sarif
- name: Upload CodeQL sarif
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: sarif-results/cpp.sarif
Lint-codespell:
needs: Formatting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
with:
submodules: false
- name: Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Dependencies
run: |
# Install Python packages
python -m pip install --upgrade pip
pip install codespell
- name: Run codespell
run: codespell