-
Notifications
You must be signed in to change notification settings - Fork 36
282 lines (271 loc) · 10.9 KB
/
release.yaml
File metadata and controls
282 lines (271 loc) · 10.9 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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
name: Release packages
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag with leading v, for example v2.6.3. Minimum supported: v2.6.3'
required: true
type: string
ubuntu_20_04:
description: 'Build Ubuntu 20.04 package'
required: false
type: boolean
default: true
ubuntu_22_04:
description: 'Build Ubuntu 22.04 package'
required: false
type: boolean
default: false
ubuntu_24_04:
description: 'Build Ubuntu 24.04 package'
required: false
type: boolean
default: false
ubuntu_24_04_arm:
description: 'Build Ubuntu 24.04 ARM package'
required: false
type: boolean
default: false
fedora_39:
description: 'Build Fedora 39 package'
required: false
type: boolean
default: true
macos_15:
description: 'Build macOS 15 package'
required: false
type: boolean
default: false
macos_26:
description: 'Build macOS 26 package'
required: false
type: boolean
default: false
macos_26_intel:
description: 'Build macOS 26 Intel package'
required: false
type: boolean
default: false
windows_2022:
description: 'Build Windows 2022 package'
required: false
type: boolean
default: false
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ inputs.tag }}
cancel-in-progress: true
jobs:
# Select release targets based on workflow inputs, and output the selected targets for downstream jobs.
# This allows us to conditionally run jobs based on user input, which is not natively supported by GitHub Actions.
select-targets:
name: Select release targets
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.matrix.outputs.tag }}
version: ${{ steps.matrix.outputs.version }}
linux: ${{ steps.matrix.outputs.linux }}
macos: ${{ steps.matrix.outputs.macos }}
windows: ${{ steps.matrix.outputs.windows }}
steps:
- id: matrix
env:
RELEASE_TAG: ${{ inputs.tag }}
BUILD_UBUNTU_20_04: ${{ inputs.ubuntu_20_04 }}
BUILD_UBUNTU_22_04: ${{ inputs.ubuntu_22_04 }}
BUILD_UBUNTU_24_04: ${{ inputs.ubuntu_24_04 }}
BUILD_UBUNTU_24_04_ARM: ${{ inputs.ubuntu_24_04_arm }}
BUILD_FEDORA_39: ${{ inputs.fedora_39 }}
BUILD_MACOS_15: ${{ inputs.macos_15 }}
BUILD_MACOS_26: ${{ inputs.macos_26 }}
BUILD_MACOS_26_INTEL: ${{ inputs.macos_26_intel }}
BUILD_WINDOWS_2022: ${{ inputs.windows_2022 }}
run: |
python3 - <<'PY'
import json
import os
import re
release_tag = os.environ["RELEASE_TAG"].strip()
if not re.fullmatch(r"v[0-9]+\.[0-9]+\.[0-9]+", release_tag):
raise SystemExit("Release tag must use format vX.Y.Z, for example v2.6.3.")
release_version = release_tag[1:]
linux = []
macos = []
windows = []
if os.environ["BUILD_UBUNTU_20_04"] == "true":
linux.append({"distro": "Ubuntu", "version": "20.04", "image": "ubuntu:20.04", "runner": "ubuntu-latest", "key": "u2004"})
if os.environ["BUILD_UBUNTU_22_04"] == "true":
linux.append({"distro": "Ubuntu", "version": "22.04", "image": "ubuntu:22.04", "runner": "ubuntu-latest", "key": "u2204"})
if os.environ["BUILD_UBUNTU_24_04"] == "true":
linux.append({"distro": "Ubuntu", "version": "24.04", "image": "ubuntu:24.04", "runner": "ubuntu-latest", "key": "u2404"})
if os.environ["BUILD_UBUNTU_24_04_ARM"] == "true":
linux.append({"distro": "Ubuntu", "version": "24.04 ARM", "image": "ubuntu:24.04", "runner": "ubuntu-24.04-arm", "key": "u2404-arm"})
if os.environ["BUILD_FEDORA_39"] == "true":
linux.append({"distro": "Fedora", "version": "39", "image": "fedora:39", "runner": "ubuntu-latest", "key": "fc39"})
if os.environ["BUILD_MACOS_15"] == "true":
macos.append({"name": "macOS 15", "runner": "macos-15"})
if os.environ["BUILD_MACOS_26"] == "true":
macos.append({"name": "macOS 26", "runner": "macos-26"})
if os.environ["BUILD_MACOS_26_INTEL"] == "true":
macos.append({"name": "macOS 26 Intel", "runner": "macos-26-intel"})
if os.environ["BUILD_WINDOWS_2022"] == "true":
windows.append({"name": "Windows 2022", "runner": "windows-2022"})
if not linux and not macos and not windows:
raise SystemExit("Select at least one release target.")
with open(os.environ["GITHUB_OUTPUT"], "a") as output:
output.write("tag=" + release_tag + "\n")
output.write("version=" + release_version + "\n")
output.write("linux=" + json.dumps(linux) + "\n")
output.write("macos=" + json.dumps(macos) + "\n")
output.write("windows=" + json.dumps(windows) + "\n")
PY
linux:
name: Release package for ${{ matrix.os.distro }} ${{ matrix.os.version }}
needs: select-targets
if: needs.select-targets.outputs.linux != '[]'
runs-on: ${{ matrix.os.runner }}
container: ${{ matrix.os.image }}
timeout-minutes: 100
env:
BUILD_SHARED_LIBS: ON
MILVUS_USE_PYTHON_VENV: ON
CONAN_LIBCXX: libstdc++11
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(needs.select-targets.outputs.linux) }}
steps:
- name: Env
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.select-targets.outputs.tag }}
- name: Prepare
run: |
sh scripts/install_deps.sh
- name: Build
run: |
. ~/.venv/bin/activate
export MILVUS_SDK_VERSION="${{ needs.select-targets.outputs.version }}"
make test-release
cmake --build cmake_build --target package --parallel 4
- name: Verify package
run: |
. ~/.venv/bin/activate
sh scripts/verify_package_linux.sh cmake_build/Pack
- name: Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.select-targets.outputs.tag }}
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
artifacts: cmake_build/Pack/libmilvus-*
token: ${{ secrets.GITHUB_TOKEN }}
macos:
name: Release package for ${{ matrix.os.name }}
needs: select-targets
if: needs.select-targets.outputs.macos != '[]'
runs-on: ${{ matrix.os.runner }}
timeout-minutes: 75
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(needs.select-targets.outputs.macos) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.select-targets.outputs.tag }}
- name: Prepare
run: |
mkdir ~/.venv
python3 -m venv ~/.venv
source ~/.venv/bin/activate
sh scripts/install_deps.sh
- name: Build
run: |
source ~/.venv/bin/activate
export MILVUS_SDK_VERSION="${{ needs.select-targets.outputs.version }}"
make test-release
cmake --build cmake_build --target package --parallel 4
- name: Verify package
run: |
sh scripts/verify_package_linux.sh cmake_build/Pack
- name: Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.select-targets.outputs.tag }}
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
artifacts: cmake_build/Pack/libmilvus-*
token: ${{ secrets.GITHUB_TOKEN }}
windows:
name: Release package for ${{ matrix.os.name }}
needs: select-targets
if: needs.select-targets.outputs.windows != '[]'
runs-on: ${{ matrix.os.runner }}
timeout-minutes: 75
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(needs.select-targets.outputs.windows) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.select-targets.outputs.tag }}
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
shell: cmd
run: |
choco install cmake ninja ccache --no-progress
if errorlevel 1 exit /b %errorlevel%
python -m pip install -U pip
if errorlevel 1 exit /b %errorlevel%
python -m pip install "conan>=2,<3"
if errorlevel 1 exit /b %errorlevel%
cmake --version
ninja --version
conan --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"
if errorlevel 1 exit /b %errorlevel%
conan profile detect --force
if errorlevel 1 exit /b %errorlevel%
where ccache >nul 2>&1 && (set LAUNCHER=-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache) || (set LAUNCHER=)
set CMAKE_POLICY_VERSION_MINIMUM=3.5
conan install . -of build -s build_type=Release -s compiler.cppstd=14 -s:b build_type=Release -s:b compiler.cppstd=17 -o "&:shared=True" -o "&:with_tests=True" -c tools.cmake.cmaketoolchain:generator=Ninja -c tools.build:jobs=4 --build=missing
if errorlevel 1 exit /b %errorlevel%
if not exist build\build\Release\generators\conan_toolchain.cmake exit /b 1
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build\build\Release\generators\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DMILVUS_BUILD_TEST=YES -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_FROM_CONAN=ON -DMILVUS_SDK_VERSION=${{ needs.select-targets.outputs.version }} -G Ninja %LAUNCHER%
if errorlevel 1 exit /b %errorlevel%
cmake --build build
if errorlevel 1 exit /b %errorlevel%
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%
cmake --build build --target package
if errorlevel 1 exit /b %errorlevel%
- name: Verify package
shell: pwsh
run: |
./scripts/verify_package_windows.ps1 build/Pack
- name: Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.select-targets.outputs.tag }}
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
artifacts: build/Pack/libmilvus-*
token: ${{ secrets.GITHUB_TOKEN }}