11name : Build and test
22on :
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
1829concurrency :
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
2233jobs :
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
0 commit comments