-
Notifications
You must be signed in to change notification settings - Fork 9
240 lines (236 loc) · 7.98 KB
/
tests.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
name: tests
on:
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read # Required when overriding permissions
pull-requests: write # For posting coverage report
checks: write
# Newer commits should cancel old runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
copyright:
name: Copyright check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Check to see if source files have the correct copyright header
run: ./scripts/check_copyright.py
clang-format:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- "src"
- "include"
- "tests"
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: "17"
check-path: ${{ matrix.path }}
clang-tidy:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.28"
- run: pip install torch==2.2.2
- run: |
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DNEML2_TESTS=OFF \
-DNEML2_RUNNER=OFF \
-DNEML2_PYBIND=OFF \
-DNEML2_DOC=OFF \
-DNEML2_CLANG_TIDY=ON \
-B build \
.
- run: cmake --build build --target all -j 2 --
build-test:
needs: clang-format
strategy:
matrix:
os: [ubuntu-latest, macos-12]
btype: [Release, Debug]
unity: [ON, OFF]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.28"
- run: pip install torch==2.2.2
- run: |
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.btype }} \
-DCMAKE_UNITY_BUILD=${{ matrix.unity }} \
-DNEML2_TESTS=ON \
-DNEML2_RUNNER=OFF \
-DNEML2_PYBIND=OFF \
-DNEML2_DOC=OFF \
-B build \
.
- run: cmake --build build --target all -j 2 --
- run: cd tests && ../build/tests/unit/unit_tests -r junit > unit_tests.xml
continue-on-error: true
- run: cd tests && ../build/tests/regression/regression_tests -r junit > regression_tests.xml
continue-on-error: true
- run: cd tests && ../build/tests/verification/verification_tests -r junit > verification_tests.xml
continue-on-error: true
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: matrix.os == 'ubuntu-latest'
with:
files: tests/*.xml
check_name: Test Results (${{ matrix.os }}-${{ matrix.btype }}-${{ matrix.unity }})
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: matrix.os == 'macos-12'
with:
files: tests/*.xml
check_name: Test Results (${{ matrix.os }}-${{ matrix.btype }}-${{ matrix.unity }})
build-all:
needs: clang-format
runs-on: ubuntu-latest
strategy:
matrix:
btype: [Release, Debug]
unity: [ON, OFF]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.28"
- run: pip install torch==2.2.2
- run: |
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.btype }} \
-DCMAKE_UNITY_BUILD=${{ matrix.unity }} \
-DNEML2_TESTS=ON \
-DNEML2_RUNNER=ON \
-DNEML2_RUNNER_AS_PROFILER=ON \
-DNEML2_PYBIND=OFF \
-DNEML2_DOC=OFF \
-B build \
.
- run: cmake --build build --target all -j 2 --
- run: ./build/runner/runner runner/benchmark/elasticity/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/radret/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/isoharden/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/chaboche2/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/chaboche4/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/chaboche6/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/gtntheig/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/scpcoup/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/scpdecoup/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/scpdecoupexp/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/tcpsingle/model.i driver nbatch=1 device=cpu
- run: ./build/runner/runner runner/benchmark/tcprandom/model.i driver nbatch=1 device=cpu
coverage:
name: Code coverage check
needs: clang-format
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.28"
- run: pip install torch==2.2.2
- run: sudo apt install lcov
- run: |
cmake \
-DCMAKE_BUILD_TYPE=Coverage \
-DCMAKE_UNITY_BUILD=OFF \
-DNEML2_TESTS=ON \
-DNEML2_UNIT=ON \
-DNEML2_REGRESSION=OFF \
-DNEML2_VERIFICATION=OFF \
-DNEML2_RUNNER=OFF \
-DNEML2_PYBIND=OFF \
-DNEML2_DOC=OFF \
-B build \
.
- run: cmake --build build --target all -j 2 --
- run: build/scripts/coverage.sh
- uses: romeovs/lcov-reporter-action@v0.3.1
with:
lcov-file: build/coverage/coverage.info
github-token: ${{ secrets.PR_ACTION }}
delete-old-comments: true
cmake-integration:
name: Test CMake integration as a subproject
needs: clang-format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
path: neml2
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.28"
- run: pip install torch==2.2.2
- name: Create a source file for testing purposes
run: |
echo -e "\
#include \"neml2/base/Registry.h\"\n\
int main() {\n\
return 0;\n\
}\
" > main.cxx
- run: cat main.cxx
- name: Create a CMakeLists.txt file for testing purposes
run: |
echo -e "\
cmake_minimum_required(VERSION 3.28)
project(FOO)\n\
add_subdirectory(neml2)\n\
add_executable(foo main.cxx)\n\
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)\n\
target_link_libraries(foo neml2)\n\
" > CMakeLists.txt
- run: cat CMakeLists.txt
- name: Configure with CMake
run: cmake -DNEML2_TESTS=OFF -B build .
- name: Compile
run: cmake --build build --target all -j 2 --
- run: ./build/foo