Avoid conflict with system-installed nlohmann #1414
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and test | |
| on: | |
| pull_request: | |
| # Run CI for any change except documentation and selected repo meta files | |
| paths: | |
| - '**' | |
| - '!**.md' | |
| - '!doc/**' | |
| - '!.gitignore' | |
| - '!codecov.yml' | |
| - '!LICENSE' | |
| - '!OWNERS' | |
| - '!libmilvus.spec.rpkg' | |
| push: | |
| branches: | |
| - master | |
| - '2.6' | |
| - '3.0' | |
| paths: | |
| - '**' | |
| - '!**.md' | |
| - '!doc/**' | |
| - '!.gitignore' | |
| - '!codecov.yml' | |
| - '!LICENSE' | |
| - '!OWNERS' | |
| - '!libmilvus.spec.rpkg' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Detect whether the PR touches core SDK files (src, cmake, test, | |
| # thirdparty, scripts, workflow, lint configs) or only peripheral files | |
| # (examples/**). Changes limited to examples/** skip the heavy CI jobs | |
| # (coverage, macOS, Windows) and only run the Linux build, | |
| # which is enough to catch regressions in the example code itself. | |
| changes: | |
| name: Detect path changes | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| core_relevant: ${{ steps.filter.outputs.core_relevant }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| core_relevant: | |
| - '**' | |
| - '!examples/**' | |
| - '!**.md' | |
| - '!doc/**' | |
| - '!.gitignore' | |
| - '!codecov.yml' | |
| - '!LICENSE' | |
| - '!OWNERS' | |
| - '!libmilvus.spec.rpkg' | |
| linux: | |
| name: Build and test AMD64 ${{ matrix.os.distro }} ${{ matrix.os.version }} | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| container: ${{ matrix.os.image }} | |
| # github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout. | |
| timeout-minutes: 200 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - distro: Ubuntu | |
| version: 20.04 | |
| image: ubuntu:20.04 | |
| key: u2004 | |
| build_shared_libs: ON | |
| - distro: Fedora | |
| version: 39 | |
| image: fedora:39 | |
| key: fc39 | |
| build_shared_libs: ON | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_COMPILERCHECK: content | |
| CCACHE_COMPRESS: 1 | |
| CCACHE_COMPRESSLEVEL: 5 | |
| CCACHE_MAXSIZE: 2G | |
| BUILD_SHARED_LIBS: ${{ matrix.os.build_shared_libs }} | |
| steps: | |
| - name: Env | |
| run: echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/.ccache | |
| key: linux-${{ matrix.os.key }}-ccache-${{ github.sha }} | |
| restore-keys: linux-${{ matrix.os.key }}-ccache- | |
| - name: Prepare | |
| run: | | |
| sh scripts/install_deps.sh | |
| - name: Lint | |
| if: ${{ matrix.os.distro == 'Ubuntu' }} | |
| run: | | |
| make lint | |
| - name: Unit Testing | |
| run: | | |
| make test | |
| - name: Verify package | |
| run: | | |
| cmake --build cmake_build --target package --parallel 4 | |
| sh scripts/verify_package_linux.sh cmake_build/Pack | |
| coverage-ubuntu: | |
| name: Test all with coverage | |
| # Skip for examples-only changes on PRs; run after pushes to warm branch-scoped caches. | |
| needs: changes | |
| if: always() && (github.event_name == 'push' || needs.changes.outputs.core_relevant == 'true') | |
| runs-on: ubuntu-22.04 | |
| # github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout. | |
| timeout-minutes: 200 | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_COMPILERCHECK: content | |
| CCACHE_COMPRESS: 1 | |
| CCACHE_COMPRESSLEVEL: 5 | |
| CCACHE_MAXSIZE: 2G | |
| BUILD_SHARED_LIBS: OFF | |
| steps: | |
| - name: Env | |
| run: echo "${HOME}/.local/bin" >> $GITHUB_PATH | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache Conan | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.conan2 | |
| key: ubuntu-2204-conan-${{ github.base_ref || github.ref_name }}-${{ hashFiles('conanfile.*', 'CMakeLists.txt', 'cmake/**', 'scripts/install_deps.sh') }} | |
| restore-keys: ubuntu-2204-conan-${{ github.base_ref || github.ref_name }}- | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/.ccache | |
| key: ubuntu-2204-coverage-ccache-${{ github.sha }} | |
| restore-keys: ubuntu-2204-coverage-ccache- | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.8' | |
| - name: Prepare | |
| run: | | |
| sh scripts/install_deps.sh | |
| - name: Testing With Coverage | |
| run: | | |
| JOBS=4 CMAKE_BUILD_EXAMPLES=OFF make coverage | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./code_coverage/lcov_output.info | |
| name: ubuntu-22.04-coverage | |
| disable_safe_directory: true | |
| verbose: true | |
| macos: | |
| name: Build and test macOS 15 | |
| # Skip for examples-only changes; macOS runners are scarce. | |
| needs: changes | |
| if: github.event_name == 'pull_request' && needs.changes.outputs.core_relevant == 'true' | |
| runs-on: macos-15 | |
| # github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout. | |
| timeout-minutes: 200 | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_COMPILERCHECK: content | |
| CCACHE_COMPRESS: 1 | |
| CCACHE_CPP2: true | |
| CCACHE_COMPRESSLEVEL: 5 | |
| CCACHE_MAXSIZE: 2G | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/.ccache | |
| key: macos-15-ccache-${{ github.sha }} | |
| restore-keys: macos-15-ccache- | |
| - name: Prepare | |
| run: | | |
| mkdir ~/.venv | |
| python3 -m venv ~/.venv | |
| source ~/.venv/bin/activate | |
| sh scripts/install_deps.sh | |
| - name: Unit Testing | |
| run: | | |
| source ~/.venv/bin/activate | |
| make test | |
| - name: Verify package | |
| run: | | |
| source ~/.venv/bin/activate | |
| cmake --build cmake_build --target package --parallel 4 | |
| sh scripts/verify_package_linux.sh cmake_build/Pack | |
| windows: | |
| name: Build and test windows | |
| # Skip for examples-only changes; Windows builds are slow. | |
| needs: changes | |
| if: github.event_name == 'pull_request' && needs.changes.outputs.core_relevant == 'true' | |
| runs-on: windows-2022 | |
| # github automatically evicts no-access caches after 7 days, so we set a longer timeout to avoid unnecessary workflow timeout. | |
| timeout-minutes: 200 | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_COMPILERCHECK: content | |
| CCACHE_COMPRESS: 1 | |
| CCACHE_COMPRESSLEVEL: 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/.ccache | |
| key: windows-ccache-${{ github.sha }} | |
| restore-keys: windows-ccache- | |
| - name: Install dependencies on windows | |
| shell: cmd | |
| run: | | |
| choco install cmake ninja ccache --no-progress | |
| cmake --version | |
| ninja --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" | |
| rem Enable ccache launcher only if ccache is available. Chocolatey | |
| rem sometimes fails to install it (503/504 outages); without this | |
| rem guard every compile would try to spawn a non-existent ccache.exe | |
| rem and the build would die with "CreateProcess failed". | |
| where ccache >nul 2>&1 && (set LAUNCHER=-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache) || (set LAUNCHER=) | |
| cmake -S . -B build -DMILVUS_BUILD_TEST=YES -DBUILD_SHARED_LIBS=ON -G Ninja %LAUNCHER% | |
| cmake --build build | |
| - name: Unit Testing | |
| shell: cmd | |
| run: | | |
| 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% | |
| - name: Verify install | |
| shell: cmd | |
| run: | | |
| cmake --install build --prefix build\install | |
| if exist build\install\bin\milvus_sdk.dll exit /b 0 | |
| if exist build\install\bin\libmilvus_sdk.dll exit /b 0 | |
| dir /s build\install | |
| exit /b 1 | |
| - name: Verify package | |
| shell: pwsh | |
| run: | | |
| cmake --build build --target package | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| ./scripts/verify_package_windows.ps1 build/Pack |