-
Notifications
You must be signed in to change notification settings - Fork 6
229 lines (204 loc) · 7.63 KB
/
Copy pathci.yml
File metadata and controls
229 lines (204 loc) · 7.63 KB
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
name: ci
on:
pull_request:
paths:
- "**"
push:
branches:
- main
jobs:
build:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Cache vcpkg (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: ${{ github.workspace }}\vcpkg_cache
key: vcpkg-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }}
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install libzip eigen googletest ninja lcov zlib
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install ninja -y
New-Item -ItemType Directory -Force "$env:GITHUB_WORKSPACE\vcpkg_cache" | Out-Null
git clone https://github.com/microsoft/vcpkg "$env:GITHUB_WORKSPACE\vcpkg"
& "$env:GITHUB_WORKSPACE\vcpkg\bootstrap-vcpkg.bat"
$env:VCPKG_BINARY_SOURCES="clear;files,$env:GITHUB_WORKSPACE\vcpkg_cache,readwrite"
& "$env:GITHUB_WORKSPACE\vcpkg\vcpkg.exe" install `
libzip `
eigen3 `
gtest `
zlib `
--triplet x64-windows
- name: Install OpenCppCoverage (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$installer = "$env:TEMP\OpenCppCoverageSetup.exe"
Invoke-WebRequest -Uri "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/OpenCppCoverageSetup-x64-0.9.9.0.exe" -OutFile $installer
Start-Process -FilePath $installer -ArgumentList "/VERYSILENT" -Wait
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Setup MSVC environment (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Configure (macOS)
if: runner.os == 'macOS'
run: |
BREW_PREFIX="$(brew --prefix)"
cmake -S . -B build \
-G Ninja \
-DTRX_USE_CONAN=OFF \
-DTRX_BUILD_TESTS=ON \
-DTRX_BUILD_EXAMPLES=ON \
-DTRX_ENABLE_NIFTI=ON \
-DCMAKE_PREFIX_PATH="${BREW_PREFIX}" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS="--coverage" \
-DCMAKE_CXX_FLAGS="--coverage"
- name: Configure (Windows)
if: runner.os == 'Windows'
run: >
cmake -S . -B build
-G Ninja
-DTRX_USE_CONAN=OFF
-DTRX_BUILD_TESTS=ON
-DTRX_ENABLE_NIFTI=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build build --config Release
- name: Test (macOS)
if: runner.os == 'macOS'
run: ctest --test-dir build --output-on-failure -C Release
- name: Test with coverage (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: >
& "C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe"
--export_type cobertura:coverage.xml
--sources ${{ github.workspace }}
-- ctest --test-dir build --output-on-failure -C Release
- name: Generate coverage summary (macOS)
if: runner.os == 'macOS'
run: |
lcov --capture --directory build \
--rc geninfo_unexecuted_blocks=1 \
--ignore-errors mismatch,mismatch,inconsistent,inconsistent,unsupported,format,format \
--output-file coverage.info
lcov --remove coverage.info "/opt/homebrew/*" "/Applications/Xcode_*.app/*" \
"/Users/runner/work/trx-cpp/trx-cpp/third_party/*" \
"/Users/runner/work/trx-cpp/trx-cpp/examples/*" \
"/Users/runner/work/trx-cpp/trx-cpp/bench/*" \
--ignore-errors mismatch,mismatch,inconsistent,inconsistent,unsupported,format,format,unused \
--output-file coverage.info
lcov --summary coverage.info --ignore-errors mismatch,mismatch,inconsistent,inconsistent,unsupported,format,format
- name: Upload coverage to Codecov (macOS)
if: runner.os == 'macOS'
uses: codecov/codecov-action@v4
with:
files: coverage.info
flags: macos
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codecov (Windows)
if: runner.os == 'Windows'
uses: codecov/codecov-action@v4
with:
files: coverage.xml
flags: windows
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
zlib-only-host-build:
name: zlib-only host (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Cache vcpkg (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: ${{ github.workspace }}\vcpkg_cache
key: zlib-only-vcpkg-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }}
- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
g++ \
ninja-build \
zlib1g-dev \
libgtest-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install ninja zlib googletest
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install ninja -y
New-Item -ItemType Directory -Force "$env:GITHUB_WORKSPACE\vcpkg_cache" | Out-Null
git clone https://github.com/microsoft/vcpkg "$env:GITHUB_WORKSPACE\vcpkg"
& "$env:GITHUB_WORKSPACE\vcpkg\bootstrap-vcpkg.bat"
$env:VCPKG_BINARY_SOURCES="clear;files,$env:GITHUB_WORKSPACE\vcpkg_cache,readwrite"
& "$env:GITHUB_WORKSPACE\vcpkg\vcpkg.exe" install `
zlib `
gtest `
--triplet x64-windows
- name: Setup MSVC environment (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Configure (Ubuntu)
if: runner.os == 'Linux'
run: |
cmake -S . -B build-zlib-only \
-G Ninja \
-DTRX_USE_CONAN=OFF \
-DTRX_BUILD_TESTS=ON \
-DTRX_BUILD_EXAMPLES=ON \
-DTRX_ENABLE_NIFTI=ON \
-DCMAKE_BUILD_TYPE=Release
- name: Configure (macOS)
if: runner.os == 'macOS'
run: |
BREW_PREFIX="$(brew --prefix)"
cmake -S . -B build-zlib-only \
-G Ninja \
-DTRX_USE_CONAN=OFF \
-DTRX_BUILD_TESTS=ON \
-DTRX_BUILD_EXAMPLES=ON \
-DTRX_ENABLE_NIFTI=ON \
-DCMAKE_PREFIX_PATH="${BREW_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release
- name: Configure (Windows)
if: runner.os == 'Windows'
run: >
cmake -S . -B build-zlib-only
-G Ninja
-DTRX_USE_CONAN=OFF
-DTRX_BUILD_TESTS=ON
-DTRX_ENABLE_NIFTI=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build build-zlib-only --config Release
- name: Test
run: ctest --test-dir build-zlib-only --output-on-failure -C Release