Skip to content

Commit fa46123

Browse files
authored
Manually trigger release workflow (#481)
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent de87192 commit fa46123

15 files changed

Lines changed: 587 additions & 99 deletions

File tree

.github/workflows/main.yaml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'test/**'
1111
- 'thirdparty/**'
1212
- '.github/workflows/main.yaml'
13+
- '.github/workflows/release.yaml'
1314
- '!**.md'
1415
- '.clang-format'
1516
- '.clang-tidy'
@@ -42,6 +43,7 @@ jobs:
4243
- 'test/**'
4344
- 'thirdparty/**'
4445
- '.github/workflows/main.yaml'
46+
- '.github/workflows/release.yaml'
4547
- '.clang-format'
4648
- '.clang-tidy'
4749
@@ -58,16 +60,19 @@ jobs:
5860
version: 20.04
5961
image: ubuntu:20.04
6062
key: u2004
63+
build_shared_libs: ON
6164
- distro: Fedora
6265
version: 39
6366
image: fedora:39
6467
key: fc39
68+
build_shared_libs: ON
6569
env:
6670
CCACHE_DIR: ${{ github.workspace }}/.ccache
6771
CCACHE_COMPILERCHECK: content
6872
CCACHE_COMPRESS: 1
6973
CCACHE_COMPRESSLEVEL: 5
7074
CCACHE_MAXSIZE: 2G
75+
BUILD_SHARED_LIBS: ${{ matrix.os.build_shared_libs }}
7176
steps:
7277
- name: Env
7378
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
@@ -91,6 +96,10 @@ jobs:
9196
- name: Unit Testing
9297
run: |
9398
make test
99+
- name: Verify package
100+
run: |
101+
cmake --build cmake_build --target package --parallel 4
102+
sh scripts/verify_package_linux.sh cmake_build/Pack
94103
integration-test:
95104
name: Integration test
96105
# Skip for examples-only changes; linux job alone validates them.
@@ -136,6 +145,7 @@ jobs:
136145
CCACHE_COMPRESS: 1
137146
CCACHE_COMPRESSLEVEL: 5
138147
CCACHE_MAXSIZE: 2G
148+
BUILD_SHARED_LIBS: OFF
139149
steps:
140150
- name: Env
141151
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
@@ -199,6 +209,11 @@ jobs:
199209
run: |
200210
source ~/.venv/bin/activate
201211
make test
212+
- name: Verify package
213+
run: |
214+
source ~/.venv/bin/activate
215+
cmake --build cmake_build --target package --parallel 4
216+
sh scripts/verify_package_linux.sh cmake_build/Pack
202217
windows:
203218
name: Build and test windows
204219
# Skip for examples-only changes; Windows builds are slow.
@@ -237,10 +252,26 @@ jobs:
237252
rem guard every compile would try to spawn a non-existent ccache.exe
238253
rem and the build would die with "CreateProcess failed".
239254
where ccache >nul 2>&1 && (set LAUNCHER=-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache) || (set LAUNCHER=)
240-
cmake -S . -B build -DMILVUS_BUILD_TEST=YES -G Ninja %LAUNCHER%
255+
cmake -S . -B build -DMILVUS_BUILD_TEST=YES -DBUILD_SHARED_LIBS=ON -G Ninja %LAUNCHER%
241256
cmake --build build
242257
- name: Unit Testing
243258
shell: cmd
244259
run: |
260+
set PATH=%CD%\build\src;%PATH%
261+
rem testing-it starts an in-process mocked gRPC server and is unstable across the Windows EXE/DLL boundary.
245262
build\test\testing-ut
246-
build\test\testing-it
263+
if errorlevel 1 exit /b %errorlevel%
264+
- name: Verify install
265+
shell: cmd
266+
run: |
267+
cmake --install build --prefix build\install
268+
if exist build\install\bin\milvus_sdk.dll exit /b 0
269+
if exist build\install\bin\libmilvus_sdk.dll exit /b 0
270+
dir /s build\install
271+
exit /b 1
272+
- name: Verify package
273+
shell: pwsh
274+
run: |
275+
cmake --build build --target package
276+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
277+
./scripts/verify_package_windows.ps1 build/Pack

.github/workflows/release.yaml

Lines changed: 244 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,278 @@
11
name: Release packages
22

3-
# This workflow is triggered on pushes or pull request to the repository.
43
on:
5-
push:
6-
tags:
7-
- v*
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Release tag with leading v, for example v2.6.3. Minimum supported: v2.6.3'
8+
required: true
9+
type: string
10+
ubuntu_20_04:
11+
description: 'Build Ubuntu 20.04 package'
12+
required: false
13+
type: boolean
14+
default: true
15+
ubuntu_22_04:
16+
description: 'Build Ubuntu 22.04 package'
17+
required: false
18+
type: boolean
19+
default: false
20+
ubuntu_24_04:
21+
description: 'Build Ubuntu 24.04 package'
22+
required: false
23+
type: boolean
24+
default: false
25+
ubuntu_24_04_arm:
26+
description: 'Build Ubuntu 24.04 ARM package'
27+
required: false
28+
type: boolean
29+
default: false
30+
fedora_39:
31+
description: 'Build Fedora 39 package'
32+
required: false
33+
type: boolean
34+
default: true
35+
macos_15:
36+
description: 'Build macOS 15 package'
37+
required: false
38+
type: boolean
39+
default: false
40+
macos_26:
41+
description: 'Build macOS 26 package'
42+
required: false
43+
type: boolean
44+
default: false
45+
macos_26_intel:
46+
description: 'Build macOS 26 Intel package'
47+
required: false
48+
type: boolean
49+
default: false
50+
windows_2022:
51+
description: 'Build Windows 2022 package'
52+
required: false
53+
type: boolean
54+
default: false
55+
56+
permissions:
57+
contents: write
858

959
concurrency:
10-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
60+
group: ${{ github.workflow }}-${{ inputs.tag }}
1161
cancel-in-progress: true
1262

1363
jobs:
64+
select-targets:
65+
name: Select release targets
66+
runs-on: ubuntu-latest
67+
outputs:
68+
tag: ${{ steps.matrix.outputs.tag }}
69+
version: ${{ steps.matrix.outputs.version }}
70+
linux: ${{ steps.matrix.outputs.linux }}
71+
macos: ${{ steps.matrix.outputs.macos }}
72+
windows: ${{ steps.matrix.outputs.windows }}
73+
steps:
74+
- id: matrix
75+
env:
76+
RELEASE_TAG: ${{ inputs.tag }}
77+
BUILD_UBUNTU_20_04: ${{ inputs.ubuntu_20_04 }}
78+
BUILD_UBUNTU_22_04: ${{ inputs.ubuntu_22_04 }}
79+
BUILD_UBUNTU_24_04: ${{ inputs.ubuntu_24_04 }}
80+
BUILD_UBUNTU_24_04_ARM: ${{ inputs.ubuntu_24_04_arm }}
81+
BUILD_FEDORA_39: ${{ inputs.fedora_39 }}
82+
BUILD_MACOS_15: ${{ inputs.macos_15 }}
83+
BUILD_MACOS_26: ${{ inputs.macos_26 }}
84+
BUILD_MACOS_26_INTEL: ${{ inputs.macos_26_intel }}
85+
BUILD_WINDOWS_2022: ${{ inputs.windows_2022 }}
86+
run: |
87+
python3 - <<'PY'
88+
import json
89+
import os
90+
import re
91+
92+
release_tag = os.environ["RELEASE_TAG"].strip()
93+
if not re.fullmatch(r"v[0-9]+\.[0-9]+\.[0-9]+", release_tag):
94+
raise SystemExit("Release tag must use format vX.Y.Z, for example v2.6.3.")
95+
release_version = release_tag[1:]
96+
97+
linux = []
98+
macos = []
99+
windows = []
100+
if os.environ["BUILD_UBUNTU_20_04"] == "true":
101+
linux.append({"distro": "Ubuntu", "version": "20.04", "image": "ubuntu:20.04", "runner": "ubuntu-latest", "key": "u2004"})
102+
if os.environ["BUILD_UBUNTU_22_04"] == "true":
103+
linux.append({"distro": "Ubuntu", "version": "22.04", "image": "ubuntu:22.04", "runner": "ubuntu-latest", "key": "u2204"})
104+
if os.environ["BUILD_UBUNTU_24_04"] == "true":
105+
linux.append({"distro": "Ubuntu", "version": "24.04", "image": "ubuntu:24.04", "runner": "ubuntu-latest", "key": "u2404"})
106+
if os.environ["BUILD_UBUNTU_24_04_ARM"] == "true":
107+
linux.append({"distro": "Ubuntu", "version": "24.04 ARM", "image": "ubuntu:24.04", "runner": "ubuntu-24.04-arm", "key": "u2404-arm"})
108+
if os.environ["BUILD_FEDORA_39"] == "true":
109+
linux.append({"distro": "Fedora", "version": "39", "image": "fedora:39", "runner": "ubuntu-latest", "key": "fc39"})
110+
if os.environ["BUILD_MACOS_15"] == "true":
111+
macos.append({"name": "macOS 15", "runner": "macos-15"})
112+
if os.environ["BUILD_MACOS_26"] == "true":
113+
macos.append({"name": "macOS 26", "runner": "macos-26"})
114+
if os.environ["BUILD_MACOS_26_INTEL"] == "true":
115+
macos.append({"name": "macOS 26 Intel", "runner": "macos-26-intel"})
116+
if os.environ["BUILD_WINDOWS_2022"] == "true":
117+
windows.append({"name": "Windows 2022", "runner": "windows-2022"})
118+
119+
if not linux and not macos and not windows:
120+
raise SystemExit("Select at least one release target.")
121+
122+
with open(os.environ["GITHUB_OUTPUT"], "a") as output:
123+
output.write("tag=" + release_tag + "\n")
124+
output.write("version=" + release_version + "\n")
125+
output.write("linux=" + json.dumps(linux) + "\n")
126+
output.write("macos=" + json.dumps(macos) + "\n")
127+
output.write("windows=" + json.dumps(windows) + "\n")
128+
PY
129+
14130
linux:
15131
name: Release package for ${{ matrix.os.distro }} ${{ matrix.os.version }}
16-
runs-on: ubuntu-latest
132+
needs: select-targets
133+
if: needs.select-targets.outputs.linux != '[]'
134+
runs-on: ${{ matrix.os.runner }}
17135
container: ${{ matrix.os.image }}
18136
timeout-minutes: 45
137+
env:
138+
BUILD_SHARED_LIBS: ON
19139
strategy:
20140
fail-fast: false
21-
# Release binary matrix — intentionally minimal:
22-
# Ubuntu 20.04 (glibc 2.31) covers Ubuntu 20.04+, Debian 11+
23-
# Fedora 39 covers Fedora 39+
24-
# Adding more distros is optional; existing users can use the above
25-
# packages on any distro with compatible or newer glibc. See CHANGELOG
26-
# for the rationale behind dropping Ubuntu 22.04 and Fedora 38.
27141
matrix:
28-
os:
29-
- distro: Ubuntu
30-
version: 20.04
31-
image: ubuntu:20.04
32-
key: u2004
33-
- distro: Fedora
34-
version: 39
35-
image: fedora:39
36-
key: fc39
142+
os: ${{ fromJSON(needs.select-targets.outputs.linux) }}
37143
steps:
38144
- name: Env
39145
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
40146
- name: Checkout
41147
uses: actions/checkout@v4
148+
with:
149+
ref: ${{ needs.select-targets.outputs.tag }}
42150
- name: Prepare
43151
run: |
44152
sh scripts/install_deps.sh
45153
- name: Build
46154
run: |
47-
export MILVUS_SDK_VERSION="$(echo ${{ github.event.ref }} | sed s@refs/tags/v@@)"
155+
export MILVUS_SDK_VERSION="${{ needs.select-targets.outputs.version }}"
48156
make test
49157
make clean
50158
make package
159+
- name: Verify package
160+
run: |
161+
sh scripts/verify_package_linux.sh cmake_build/Pack
51162
- name: Release
52163
uses: ncipollo/release-action@v1
53164
with:
165+
tag: ${{ needs.select-targets.outputs.tag }}
54166
allowUpdates: true
167+
omitNameDuringUpdate: true
168+
omitBodyDuringUpdate: true
55169
artifacts: cmake_build/Pack/libmilvus-*
56170
token: ${{ secrets.GITHUB_TOKEN }}
171+
172+
macos:
173+
name: Release package for ${{ matrix.os.name }}
174+
needs: select-targets
175+
if: needs.select-targets.outputs.macos != '[]'
176+
runs-on: ${{ matrix.os.runner }}
177+
timeout-minutes: 75
178+
strategy:
179+
fail-fast: false
180+
matrix:
181+
os: ${{ fromJSON(needs.select-targets.outputs.macos) }}
182+
steps:
183+
- name: Checkout
184+
uses: actions/checkout@v4
185+
with:
186+
ref: ${{ needs.select-targets.outputs.tag }}
187+
- name: Prepare
188+
run: |
189+
mkdir ~/.venv
190+
python3 -m venv ~/.venv
191+
source ~/.venv/bin/activate
192+
sh scripts/install_deps.sh
193+
- name: Build
194+
run: |
195+
source ~/.venv/bin/activate
196+
export MILVUS_SDK_VERSION="${{ needs.select-targets.outputs.version }}"
197+
make test
198+
make clean
199+
make package
200+
- name: Verify package
201+
run: |
202+
sh scripts/verify_package_linux.sh cmake_build/Pack
203+
- name: Release
204+
uses: ncipollo/release-action@v1
205+
with:
206+
tag: ${{ needs.select-targets.outputs.tag }}
207+
allowUpdates: true
208+
omitNameDuringUpdate: true
209+
omitBodyDuringUpdate: true
210+
artifacts: cmake_build/Pack/libmilvus-*
211+
token: ${{ secrets.GITHUB_TOKEN }}
212+
213+
windows:
214+
name: Release package for ${{ matrix.os.name }}
215+
needs: select-targets
216+
if: needs.select-targets.outputs.windows != '[]'
217+
runs-on: ${{ matrix.os.runner }}
218+
timeout-minutes: 75
219+
strategy:
220+
fail-fast: false
221+
matrix:
222+
os: ${{ fromJSON(needs.select-targets.outputs.windows) }}
223+
steps:
224+
- name: Checkout
225+
uses: actions/checkout@v4
226+
with:
227+
ref: ${{ needs.select-targets.outputs.tag }}
228+
- uses: actions/setup-python@v5
229+
with:
230+
python-version: '3.11'
231+
- name: Install dependencies
232+
shell: cmd
233+
run: |
234+
choco install cmake ninja ccache --no-progress
235+
if errorlevel 1 exit /b %errorlevel%
236+
python -m pip install -U pip
237+
if errorlevel 1 exit /b %errorlevel%
238+
python -m pip install "conan>=2,<3"
239+
if errorlevel 1 exit /b %errorlevel%
240+
cmake --version
241+
ninja --version
242+
conan --version
243+
where ccache >nul 2>&1 && (ccache --version) || (echo ccache not installed - build will proceed without caching)
244+
- name: Build
245+
shell: cmd
246+
run: |
247+
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
248+
if errorlevel 1 exit /b %errorlevel%
249+
conan profile detect --force
250+
if errorlevel 1 exit /b %errorlevel%
251+
where ccache >nul 2>&1 && (set LAUNCHER=-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache) || (set LAUNCHER=)
252+
set CMAKE_POLICY_VERSION_MINIMUM=3.5
253+
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
254+
if errorlevel 1 exit /b %errorlevel%
255+
if not exist build\build\Release\generators\conan_toolchain.cmake exit /b 1
256+
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build\build\Release\generators\conan_toolchain.cmake -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%
257+
if errorlevel 1 exit /b %errorlevel%
258+
cmake --build build
259+
if errorlevel 1 exit /b %errorlevel%
260+
set PATH=%CD%\build\src;%PATH%
261+
rem testing-it starts an in-process mocked gRPC server and is unstable across the Windows EXE/DLL boundary.
262+
build\test\testing-ut
263+
if errorlevel 1 exit /b %errorlevel%
264+
cmake --build build --target package
265+
if errorlevel 1 exit /b %errorlevel%
266+
- name: Verify package
267+
shell: pwsh
268+
run: |
269+
./scripts/verify_package_windows.ps1 build/Pack
270+
- name: Release
271+
uses: ncipollo/release-action@v1
272+
with:
273+
tag: ${{ needs.select-targets.outputs.tag }}
274+
allowUpdates: true
275+
omitNameDuringUpdate: true
276+
omitBodyDuringUpdate: true
277+
artifacts: build/Pack/libmilvus-*
278+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)