|
1 | 1 | name: Release packages |
2 | 2 |
|
3 | | -# This workflow is triggered on pushes or pull request to the repository. |
4 | 3 | 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 |
8 | 58 |
|
9 | 59 | concurrency: |
10 | | - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 60 | + group: ${{ github.workflow }}-${{ inputs.tag }} |
11 | 61 | cancel-in-progress: true |
12 | 62 |
|
13 | 63 | 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 | +
|
14 | 130 | linux: |
15 | 131 | 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 }} |
17 | 135 | container: ${{ matrix.os.image }} |
18 | 136 | timeout-minutes: 45 |
| 137 | + env: |
| 138 | + BUILD_SHARED_LIBS: ON |
19 | 139 | strategy: |
20 | 140 | 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. |
27 | 141 | 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) }} |
37 | 143 | steps: |
38 | 144 | - name: Env |
39 | 145 | run: echo "${HOME}/.local/bin" >> $GITHUB_PATH |
40 | 146 | - name: Checkout |
41 | 147 | uses: actions/checkout@v4 |
| 148 | + with: |
| 149 | + ref: ${{ needs.select-targets.outputs.tag }} |
42 | 150 | - name: Prepare |
43 | 151 | run: | |
44 | 152 | sh scripts/install_deps.sh |
45 | 153 | - name: Build |
46 | 154 | 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 }}" |
48 | 156 | make test |
49 | 157 | make clean |
50 | 158 | make package |
| 159 | + - name: Verify package |
| 160 | + run: | |
| 161 | + sh scripts/verify_package_linux.sh cmake_build/Pack |
51 | 162 | - name: Release |
52 | 163 | uses: ncipollo/release-action@v1 |
53 | 164 | with: |
| 165 | + tag: ${{ needs.select-targets.outputs.tag }} |
54 | 166 | allowUpdates: true |
| 167 | + omitNameDuringUpdate: true |
| 168 | + omitBodyDuringUpdate: true |
55 | 169 | artifacts: cmake_build/Pack/libmilvus-* |
56 | 170 | 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