-
Notifications
You must be signed in to change notification settings - Fork 36
267 lines (261 loc) · 9.07 KB
/
main.yaml
File metadata and controls
267 lines (261 loc) · 9.07 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
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
name: Build and test
on:
pull_request:
# Run CI for any change except documentation and selected repo meta files
paths:
- '**'
- '!**.md'
- '!doc/**'
- '!.gitignore'
- '!codecov.yml'
- '!LICENSE'
- '!OWNERS'
- '!libmilvus.spec.rpkg'
push:
branches:
- master
- '2.6'
- '3.0'
paths:
- '**'
- '!**.md'
- '!doc/**'
- '!.gitignore'
- '!codecov.yml'
- '!LICENSE'
- '!OWNERS'
- '!libmilvus.spec.rpkg'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Detect whether the PR touches core SDK files (src, cmake, test,
# thirdparty, scripts, workflow, lint configs) or only peripheral files
# (examples/**). Changes limited to examples/** skip the heavy CI jobs
# (coverage, macOS, Windows) and only run the Linux build,
# which is enough to catch regressions in the example code itself.
changes:
name: Detect path changes
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
outputs:
core_relevant: ${{ steps.filter.outputs.core_relevant }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
core_relevant:
- '**'
- '!examples/**'
- '!**.md'
- '!doc/**'
- '!.gitignore'
- '!codecov.yml'
- '!LICENSE'
- '!OWNERS'
- '!libmilvus.spec.rpkg'
linux:
name: Build and test AMD64 ${{ matrix.os.distro }} ${{ matrix.os.version }}
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
container: ${{ matrix.os.image }}
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
timeout-minutes: 200
strategy:
fail-fast: false
matrix:
os:
- distro: Ubuntu
version: 20.04
image: ubuntu:20.04
key: u2004
build_shared_libs: ON
- distro: Fedora
version: 39
image: fedora:39
key: fc39
build_shared_libs: ON
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 5
CCACHE_MAXSIZE: 2G
BUILD_SHARED_LIBS: ${{ matrix.os.build_shared_libs }}
steps:
- name: Env
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Checkout
uses: actions/checkout@v4
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.ccache
key: linux-${{ matrix.os.key }}-ccache-${{ github.sha }}
restore-keys: linux-${{ matrix.os.key }}-ccache-
- name: Prepare
run: |
sh scripts/install_deps.sh
- name: Lint
if: ${{ matrix.os.distro == 'Ubuntu' }}
run: |
make lint
- name: Unit Testing
run: |
make test
- name: Verify package
run: |
cmake --build cmake_build --target package --parallel 4
sh scripts/verify_package_linux.sh cmake_build/Pack
coverage-ubuntu:
name: Test all with coverage
# Skip for examples-only changes on PRs; run after pushes to warm branch-scoped caches.
needs: changes
if: always() && (github.event_name == 'push' || needs.changes.outputs.core_relevant == 'true')
runs-on: ubuntu-22.04
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
timeout-minutes: 200
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 5
CCACHE_MAXSIZE: 2G
BUILD_SHARED_LIBS: OFF
steps:
- name: Env
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Checkout
uses: actions/checkout@v4
- name: Cache Conan
uses: actions/cache@v4
with:
path: ~/.conan2
key: ubuntu-2204-conan-${{ github.base_ref || github.ref_name }}-${{ hashFiles('conanfile.*', 'CMakeLists.txt', 'cmake/**', 'scripts/install_deps.sh') }}
restore-keys: ubuntu-2204-conan-${{ github.base_ref || github.ref_name }}-
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.ccache
key: ubuntu-2204-coverage-ccache-${{ github.sha }}
restore-keys: ubuntu-2204-coverage-ccache-
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Prepare
run: |
sh scripts/install_deps.sh
- name: Testing With Coverage
run: |
JOBS=4 CMAKE_BUILD_EXAMPLES=OFF make coverage
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
files: ./code_coverage/lcov_output.info
name: ubuntu-22.04-coverage
disable_safe_directory: true
verbose: true
macos:
name: Build and test macOS 15
# Skip for examples-only changes; macOS runners are scarce.
needs: changes
if: github.event_name == 'pull_request' && needs.changes.outputs.core_relevant == 'true'
runs-on: macos-15
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
timeout-minutes: 200
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_CPP2: true
CCACHE_COMPRESSLEVEL: 5
CCACHE_MAXSIZE: 2G
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache ccache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.ccache
key: macos-15-ccache-${{ github.sha }}
restore-keys: macos-15-ccache-
- name: Prepare
run: |
mkdir ~/.venv
python3 -m venv ~/.venv
source ~/.venv/bin/activate
sh scripts/install_deps.sh
- name: Unit Testing
run: |
source ~/.venv/bin/activate
make test
- name: Verify package
run: |
source ~/.venv/bin/activate
cmake --build cmake_build --target package --parallel 4
sh scripts/verify_package_linux.sh cmake_build/Pack
windows:
name: Build and test windows
# Skip for examples-only changes; Windows builds are slow.
needs: changes
if: github.event_name == 'pull_request' && needs.changes.outputs.core_relevant == 'true'
runs-on: windows-2022
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
timeout-minutes: 200
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache ccache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.ccache
key: windows-ccache-${{ github.sha }}
restore-keys: windows-ccache-
- name: Install dependencies on windows
shell: cmd
run: |
choco install cmake ninja ccache --no-progress
cmake --version
ninja --version
where ccache >nul 2>&1 && (ccache --version) || (echo ccache not installed - build will proceed without caching)
- name: Build
shell: cmd
run: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
rem Enable ccache launcher only if ccache is available. Chocolatey
rem sometimes fails to install it (503/504 outages); without this
rem guard every compile would try to spawn a non-existent ccache.exe
rem and the build would die with "CreateProcess failed".
where ccache >nul 2>&1 && (set LAUNCHER=-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache) || (set LAUNCHER=)
cmake -S . -B build -DMILVUS_BUILD_TEST=YES -DBUILD_SHARED_LIBS=ON -G Ninja %LAUNCHER%
cmake --build build
- name: Unit Testing
shell: cmd
run: |
set PATH=%CD%\build\src;%PATH%
rem testing-it starts an in-process mocked gRPC server and is unstable across the Windows EXE/DLL boundary.
build\test\testing-ut
if errorlevel 1 exit /b %errorlevel%
- name: Verify install
shell: cmd
run: |
cmake --install build --prefix build\install
if exist build\install\bin\milvus_sdk.dll exit /b 0
if exist build\install\bin\libmilvus_sdk.dll exit /b 0
dir /s build\install
exit /b 1
- name: Verify package
shell: pwsh
run: |
cmake --build build --target package
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
./scripts/verify_package_windows.ps1 build/Pack