-
Notifications
You must be signed in to change notification settings - Fork 4
362 lines (359 loc) · 11.5 KB
/
ci-test.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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
name: Test
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
CPP:
strategy:
max-parallel: 3
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
#os: [windows-latest]
runs-on: ${{ matrix.os }}
if: ${{ github.actor != 'dependabot[bot]' || !contains(github.head_ref, 'dependabot')}}
#if: ${{github.event_name == 'workflow_dispatch'}}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version : '3.10'
- name: Install Dep on linux
if: ${{ matrix.os == 'ubuntu-latest'}}
shell: bash
run: |
pip install ninja
sudo apt-get install -y libeigen3-dev
sudo apt-get install -y libopenblas-dev lcov
- name: Install Dep on macos
if: ${{ matrix.os == 'macos-latest'}}
shell: bash
run: |
pip install ninja
brew install eigen nlohmann-json lcov libomp
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest'}}
uses: microsoft/setup-msbuild@v1.3.1
- name: Prepare Cache
if: ${{ matrix.os == 'windows-latest'}}
shell: bash
run: |
set -eux
ls C:/vcpkg
MSBuild.exe -version > msbuild_version.txt
cat msbuild_version.txt
- name: Cache vcpkg
uses: actions/cache@v3
if: ${{ matrix.os == 'windows-latest'}}
with:
path: |
C:/Users/runneradmin/AppData/Local/vcpkg/archives
key: ${{ matrix.os }}-vcpkg-${{ hashFiles('msbuild_version.txt') }}
restore-keys: |
${{ matrix.os }}-vcpkg-${{ hashFiles('msbuild_version.txt') }}
${{ matrix.os }}-vcpkg
# C:/vcpkg/installed
- name: Install Dep on windows
if: ${{ matrix.os == 'windows-latest'}}
shell: powershell
run: |
vcpkg help triplet
vcpkg search eigen3
vcpkg search openblas
vcpkg search blas
vcpkg search clpack
vcpkg search lapack-reference
vcpkg --triplet x64-windows-static install eigen3
vcpkg --triplet x64-windows install eigen3
vcpkg --triplet x64-windows-static install nlohmann-json
vcpkg --triplet x64-windows install nlohmann-json
vcpkg integrate install
# vcpkg --triplet x64-windows-static install openblas
- name: Install CMake
run: |
pip install cmake
cmake --version
- name: sccache
uses: hendrikmuhs/ccache-action@v1.2
with:
verbose: 2
variant: sccache
max-size: 1G
key: ${{ matrix.os }}-cpp-sccache-${{ hashFiles('**/CMakeLists.txt') }}-${{ env.RAND }}
restore-keys: |
${{ matrix.os }}-cpp-sccache-${{ hashFiles('**/CMakeLists.txt') }}-${{ env.RAND }}
${{ matrix.os }}-cpp-sccache-${{ hashFiles('**/CMakeLists.txt') }}
${{ matrix.os }}-cpp-sccache
- name: Prepare
shell: bash
run: mkdir build
- name: CMake Configure
if: ${{ matrix.os == 'ubuntu-latest'}}
shell: bash
run: >
cmake
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DENABLE_COVERAGE=On
-S .
-B build
- name: CMake Configure
if: ${{ matrix.os == 'macos-latest'}}
shell: bash
run: >
cmake
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-S .
-B build
- name: CMake Configure
if: ${{ matrix.os == 'windows-latest'}}
shell: powershell
run: >
cmake
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
-S .
-B build
- name: CMake Build
shell: bash
run: >
cmake
--build build
--parallel
- name: CTest Help
shell: bash
working-directory: build
run: |
ctest --help
#- name: Run cimod_test
# if: ${{ matrix.os == 'windows-latest'}}
# shell: bash
# working-directory: build
# run: |
# ./tests/Debug/cimod_test.exe
- name: CMake Test
shell: bash
working-directory: build
run: >
ctest
--extra-verbose
--parallel
--schedule-random
- name: Run gcov
if: ${{ matrix.os == 'ubuntu-latest'}}
shell: bash
working-directory: build
run: >
gcov
tests/CMakeFiles/cimod_test.dir/test.cpp.gcda
-o tests/CMakeFiles/cimod_test.dir
-p
-l
-b
- name: du -a
shell: bash
if: always()
run: |
cd build
du -a
- uses: codecov/codecov-action@v3
if: ${{ matrix.os == 'ubuntu-latest'}}
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
working-directory: build
name: cxxcimod
flags: cxxcimod
fail_ci_if_error: false
verbose: true
Python:
strategy:
max-parallel: 3
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
#os: [windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
#python-version: ['3.10']
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
runs-on: ${{ matrix.os }}
#if: ${{github.event_name == 'workflow_dispatch'}}
if: ${{ !contains(github.head_ref, 'dependabot/github_actions')}}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version : ${{ matrix.python-version }}
architecture: 'x64'
- name: Get Python Version
shell: bash
run: |
set -eux
python --version > python_version.txt
cat python_version.txt
- name: Pip-Tools
shell: bash
run: |
python -m pip install pip-tools
python setup.py -h
pip-compile setup.cfg
pip-compile dev-requirements.in
- uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}
${{ runner.os }}-pip-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}
${{ runner.os }}-pip-${{ hashFiles('python_version.txt') }}
- name: Update
shell: bash
run: |
set -ux
python -m pip install --upgrade pip setuptools wheel build cmake
- name: Install Dependencies
shell: bash
run: |
set -eux
pip-sync requirements.txt dev-requirements.txt
- name: sccache
if: ${{ matrix.os != 'windows-latest'}}
uses: hendrikmuhs/ccache-action@v1.2
with:
verbose: 2
variant: sccache
max-size: 1G
key: ${{ matrix.os }}-sccache-${{ hashFiles('python_version.txt') }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ env.RAND }}
restore-keys: |
${{ matrix.os }}-sccache-${{ hashFiles('python_version.txt') }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ env.RAND }}
${{ matrix.os }}-sccache-${{ hashFiles('python_version.txt') }}-${{ hashFiles('**/CMakeLists.txt') }}
${{ matrix.os }}-sccache-${{ hashFiles('python_version.txt') }}
- name: Install Eigen3 on linux
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
sudo apt-get install -y libeigen3-dev
sudo apt-get install -y libopenblas-dev
- name: Install Eigen3 on macos
if: ${{ matrix.os == 'macos-latest'}}
run: |
brew install eigen nlohmann-json libomp
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest'}}
uses: microsoft/setup-msbuild@v1.3.1
- name: Prepare Cache
if: ${{ matrix.os == 'windows-latest'}}
shell: bash
run: |
set -eux
ls C:/vcpkg
MSBuild.exe -version > msbuild_version.txt
cat msbuild_version.txt
- name: Cache vcpkg
uses: actions/cache@v3
if: ${{ matrix.os == 'windows-latest'}}
with:
path: |
C:/Users/runneradmin/AppData/Local/vcpkg/archives
key: ${{ matrix.os }}-vcpkg-${{ hashFiles('msbuild_version.txt') }}
restore-keys: |
${{ matrix.os }}-vcpkg-${{ hashFiles('msbuild_version.txt') }}
${{ matrix.os }}-vcpkg
- name: Install Eigen on windows
if: ${{ matrix.os == 'windows-latest'}}
shell: bash
run: |
vcpkg --triplet x64-windows-static install eigen3
vcpkg --triplet x64-windows install eigen3
vcpkg --triplet x64-windows-static install nlohmann-json
vcpkg --triplet x64-windows install nlohmann-json
vcpkg integrate install
- name: Show Help
shell: bash
run: |
set -eux
python setup.py --help-commands
pip install --help
- name: Build & Install
if: ${{ matrix.os == 'ubuntu-latest'}}
shell: bash
run: |
set -eux
export CMAKE_C_COMPILER_LAUNCHER=sccache
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
export CMAKE_BUILD_TYPE=Debug
python setup.py --force-cmake install --build-type Debug -G Ninja
- name: Build & Install
if: ${{ matrix.os == 'macos-latest'}}
shell: bash
run: |
set -eux
export CMAKE_C_COMPILER_LAUNCHER=sccache
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
export CMAKE_BUILD_TYPE=Debug
pip install -vvv .
- name: Build & Install
if: ${{ matrix.os == 'windows-latest'}}
shell: bash
run: |
set -eux
export CMAKE_BUILD_TYPE=Debug
export CMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
python setup.py --force-cmake install --build-type Debug
- name: Test
shell: bash
run: |
set -eux
python setup.py --build-type Debug test
- name: Generate
shell: bash
run: |
set -eux
python -m coverage xml
python -m coverage json
python -m coverage lcov
- uses: codecov/codecov-action@v3
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
name: "Cimod"
files: coverage.xml, coverage.json, coverage.lcov
flags: cimod
fail_ci_if_error: false
verbose: true
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
continue-on-error: true
if: ${{ matrix.os != 'windows-latest'}}
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v5.0.0
continue-on-error: true
if: ${{ matrix.os != 'windows-latest'}}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
- name: du
if: always()
shell: bash
run: |
du -a