Skip to content

Commit 9951e7f

Browse files
authored
Adjust workflows (#497)
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent 8e8dfd2 commit 9951e7f

6 files changed

Lines changed: 102 additions & 78 deletions

File tree

.github/mergify.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ pull_request_rules:
4545
# and are skipped for examples-only changes. Accept success OR
4646
# skipped so examples-only PRs still reach ci-passed.
4747
- or:
48-
- "check-success=Integration test"
49-
- "check-skipped=Integration test"
48+
- "check-success=Test all with coverage"
49+
- "check-skipped=Test all with coverage"
5050
- or:
5151
- "check-success=Build and test macOS 15"
5252
- "check-skipped=Build and test macOS 15"
@@ -65,13 +65,13 @@ pull_request_rules:
6565
- "check-pending=Detect path changes"
6666
- "check-pending=Build and test AMD64 Ubuntu 20.04"
6767
- "check-pending=Build and test AMD64 Fedora 39"
68-
- "check-pending=Integration test"
68+
- "check-pending=Test all with coverage"
6969
- "check-pending=Build and test macOS 15"
7070
- "check-pending=Build and test windows"
7171
- "check-failure=Detect path changes"
7272
- "check-failure=Build and test AMD64 Ubuntu 20.04"
7373
- "check-failure=Build and test AMD64 Fedora 39"
74-
- "check-failure=Integration test"
74+
- "check-failure=Test all with coverage"
7575
- "check-failure=Build and test macOS 15"
7676
- "check-failure=Build and test windows"
7777
actions:
@@ -82,7 +82,7 @@ pull_request_rules:
8282
- name: Add ci-passed when no code changes
8383
conditions:
8484
- or: *BRANCHES
85-
- -files~=^(?!.*\.(md)).*$
85+
- "-files~=^(?!(doc/|.*\\.md$|\\.gitignore$|codecov\\.yml$|LICENSE$|OWNERS$|libmilvus\\.spec\\.rpkg$)).+"
8686
actions:
8787
label:
8888
add:
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Cleanup PR caches
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
7+
permissions:
8+
actions: write
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
# When a PR is closed, delete all GitHub Actions caches associated with the PR's merge ref (refs/pull/PR_NUMBER/merge).
14+
cleanup:
15+
name: Cleanup PR caches
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Delete PR caches
19+
env:
20+
GH_TOKEN: ${{ github.token }}
21+
GH_REPO: ${{ github.repository }}
22+
PR_REF: refs/pull/${{ github.event.pull_request.number }}/merge
23+
run: |
24+
set -euo pipefail
25+
cache_ids=$(gh api --paginate "repos/$GH_REPO/actions/caches?ref=$PR_REF&per_page=100" --jq '.actions_caches[].id')
26+
if [ -z "$cache_ids" ]; then
27+
echo "No caches found for $PR_REF"
28+
exit 0
29+
fi
30+
while read -r cache_id; do
31+
gh api --method DELETE "repos/$GH_REPO/actions/caches/$cache_id"
32+
done <<< "$cache_ids"

.github/workflows/draft-release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16+
# create a draft release for an exact release tag (vX.Y.Z).
17+
# Tags that do not match this format are ignored, which allows pushing other tags (e.g. vX.Y)
18+
# without triggering the release workflow.
1619
draft-release:
1720
name: Create draft release
1821
runs-on: ubuntu-latest

.github/workflows/main.yaml

Lines changed: 56 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
11
name: Build and test
22
on:
33
pull_request:
4-
# file paths to consider in the event. Optional; defaults to all.
4+
# Run CI for any change except documentation and selected repo meta files
55
paths:
6-
- 'cmake/**'
7-
- 'examples/**'
8-
- 'scripts/**'
9-
- 'src/**'
10-
- 'test/**'
11-
- 'thirdparty/**'
12-
- '.github/workflows/main.yaml'
13-
- '.github/workflows/release.yaml'
6+
- '**'
147
- '!**.md'
15-
- '.clang-format'
16-
- '.clang-tidy'
8+
- '!doc/**'
9+
- '!.gitignore'
10+
- '!codecov.yml'
11+
- '!LICENSE'
12+
- '!OWNERS'
13+
- '!libmilvus.spec.rpkg'
14+
push:
15+
branches:
16+
- master
17+
- '2.6'
18+
- '3.0'
19+
paths:
20+
- '**'
21+
- '!**.md'
22+
- '!doc/**'
23+
- '!.gitignore'
24+
- '!codecov.yml'
25+
- '!LICENSE'
26+
- '!OWNERS'
27+
- '!libmilvus.spec.rpkg'
1728

1829
concurrency:
1930
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
20-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
31+
cancel-in-progress: true
2132

2233
jobs:
2334
# Detect whether the PR touches core SDK files (src, cmake, test,
2435
# thirdparty, scripts, workflow, lint configs) or only peripheral files
2536
# (examples/**). Changes limited to examples/** skip the heavy CI jobs
26-
# (integration, coverage, macOS, Windows) and only run the Linux build,
37+
# (coverage, macOS, Windows) and only run the Linux build,
2738
# which is enough to catch regressions in the example code itself.
2839
changes:
2940
name: Detect path changes
41+
if: github.event_name == 'pull_request'
3042
runs-on: ubuntu-latest
3143
outputs:
3244
core_relevant: ${{ steps.filter.outputs.core_relevant }}
@@ -37,18 +49,19 @@ jobs:
3749
with:
3850
filters: |
3951
core_relevant:
40-
- 'cmake/**'
41-
- 'scripts/**'
42-
- 'src/**'
43-
- 'test/**'
44-
- 'thirdparty/**'
45-
- '.github/workflows/main.yaml'
46-
- '.github/workflows/release.yaml'
47-
- '.clang-format'
48-
- '.clang-tidy'
52+
- '**'
53+
- '!examples/**'
54+
- '!**.md'
55+
- '!doc/**'
56+
- '!.gitignore'
57+
- '!codecov.yml'
58+
- '!LICENSE'
59+
- '!OWNERS'
60+
- '!libmilvus.spec.rpkg'
4961
5062
linux:
5163
name: Build and test AMD64 ${{ matrix.os.distro }} ${{ matrix.os.version }}
64+
if: github.event_name == 'pull_request'
5265
runs-on: ubuntu-latest
5366
container: ${{ matrix.os.image }}
5467
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
@@ -79,14 +92,12 @@ jobs:
7992
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
8093
- name: Checkout
8194
uses: actions/checkout@v4
82-
- name: Cache ccache and conan
95+
- name: Cache ccache
8396
uses: actions/cache@v4
8497
with:
85-
path: |
86-
${{ github.workspace }}/.ccache
87-
/github/home/.conan2
88-
key: linux-${{ matrix.os.key }}-cache-${{ github.sha }}
89-
restore-keys: linux-${{ matrix.os.key }}-cache-
98+
path: ${{ github.workspace }}/.ccache
99+
key: linux-${{ matrix.os.key }}-ccache-${{ github.sha }}
100+
restore-keys: linux-${{ matrix.os.key }}-ccache-
90101
- name: Prepare
91102
run: |
92103
sh scripts/install_deps.sh
@@ -101,44 +112,12 @@ jobs:
101112
run: |
102113
cmake --build cmake_build --target package --parallel 4
103114
sh scripts/verify_package_linux.sh cmake_build/Pack
104-
integration-test:
105-
name: Integration test
106-
# Skip for examples-only changes; linux job alone validates them.
107-
needs: changes
108-
if: needs.changes.outputs.core_relevant == 'true'
109-
runs-on: ubuntu-22.04
110-
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
111-
timeout-minutes: 200
112-
env:
113-
CCACHE_DIR: ${{ github.workspace }}/.ccache
114-
CCACHE_COMPILERCHECK: content
115-
CCACHE_COMPRESS: 1
116-
CCACHE_COMPRESSLEVEL: 5
117-
CCACHE_MAXSIZE: 2G
118-
steps:
119-
- name: Env
120-
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
121-
- name: Checkout
122-
uses: actions/checkout@v4
123-
- name: Cache ccache and conan
124-
uses: actions/cache@v4
125-
with:
126-
path: |
127-
${{ github.workspace }}/.ccache
128-
~/.conan2
129-
key: ubuntu-2204-st-cache-${{ github.sha }}
130-
restore-keys: ubuntu-2204-st-cache-
131-
- name: Prepare
132-
run: |
133-
sh scripts/install_deps.sh
134-
- name: Integration Testing
135-
run: |
136-
make st
115+
137116
coverage-ubuntu:
138117
name: Test all with coverage
139-
# Skip for examples-only changes; coverage only measures SDK code.
118+
# Skip for examples-only changes on PRs; run after pushes to warm branch-scoped caches.
140119
needs: changes
141-
if: needs.changes.outputs.core_relevant == 'true'
120+
if: always() && (github.event_name == 'push' || needs.changes.outputs.core_relevant == 'true')
142121
runs-on: ubuntu-22.04
143122
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
144123
timeout-minutes: 200
@@ -154,14 +133,18 @@ jobs:
154133
run: echo "${HOME}/.local/bin" >> $GITHUB_PATH
155134
- name: Checkout
156135
uses: actions/checkout@v4
157-
- name: Cache ccache and conan
136+
- name: Cache Conan
158137
uses: actions/cache@v4
159138
with:
160-
path: |
161-
${{ github.workspace }}/.ccache
162-
~/.conan2
163-
key: ubuntu-2204-coverage-cache-${{ github.sha }}
164-
restore-keys: ubuntu-2204-coverage-cache-
139+
path: ~/.conan2
140+
key: ubuntu-2204-conan-${{ github.base_ref || github.ref_name }}-${{ hashFiles('conanfile.*', 'CMakeLists.txt', 'cmake/**', 'scripts/install_deps.sh') }}
141+
restore-keys: ubuntu-2204-conan-${{ github.base_ref || github.ref_name }}-
142+
- name: Cache ccache
143+
uses: actions/cache@v4
144+
with:
145+
path: ${{ github.workspace }}/.ccache
146+
key: ubuntu-2204-coverage-ccache-${{ github.sha }}
147+
restore-keys: ubuntu-2204-coverage-ccache-
165148
- uses: actions/setup-python@v5
166149
with:
167150
python-version: '3.8'
@@ -178,11 +161,12 @@ jobs:
178161
name: ubuntu-22.04-coverage
179162
disable_safe_directory: true
180163
verbose: true
164+
181165
macos:
182166
name: Build and test macOS 15
183167
# Skip for examples-only changes; macOS runners are scarce.
184168
needs: changes
185-
if: needs.changes.outputs.core_relevant == 'true'
169+
if: github.event_name == 'pull_request' && needs.changes.outputs.core_relevant == 'true'
186170
runs-on: macos-15
187171
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
188172
timeout-minutes: 200
@@ -218,11 +202,12 @@ jobs:
218202
source ~/.venv/bin/activate
219203
cmake --build cmake_build --target package --parallel 4
220204
sh scripts/verify_package_linux.sh cmake_build/Pack
205+
221206
windows:
222207
name: Build and test windows
223208
# Skip for examples-only changes; Windows builds are slow.
224209
needs: changes
225-
if: needs.changes.outputs.core_relevant == 'true'
210+
if: github.event_name == 'pull_request' && needs.changes.outputs.core_relevant == 'true'
226211
runs-on: windows-2022
227212
# github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout.
228213
timeout-minutes: 200

.github/workflows/notify-conanfiles.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ run-name: notify conanfiles for ${{ github.ref_name }}
55
on:
66
push:
77
tags:
8-
- 'v*'
8+
- 'v*.*.*'
99

1010
permissions:
1111
contents: read
1212

1313
jobs:
14+
# When a new release tag is pushed to milvus-sdk-cpp, send a repository_dispatch event
15+
# to the conanfiles repo to trigger the release of the corresponding Conan package.
1416
dispatch:
1517
name: send milvus-sdk-cpp release dispatch
1618
if: github.repository == 'milvus-io/milvus-sdk-cpp'
@@ -34,7 +36,7 @@ jobs:
3436
exit 1
3537
fi
3638
37-
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
39+
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
3840
echo "Unsupported tag format: $TAG" >&2
3941
exit 1
4042
fi

.github/workflows/release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ concurrency:
6161
cancel-in-progress: true
6262

6363
jobs:
64+
# Select release targets based on workflow inputs, and output the selected targets for downstream jobs.
65+
# This allows us to conditionally run jobs based on user input, which is not natively supported by GitHub Actions.
6466
select-targets:
6567
name: Select release targets
6668
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)