enhance: add macOS C++ CI and tighten cache writes (#554) #875
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: Java CI | |
| on: | |
| push: | |
| paths: | |
| - 'cpp/**' | |
| - 'java/**' | |
| - '.github/workflows/java-ci.yml' | |
| pull_request: | |
| paths: | |
| - 'cpp/**' | |
| - 'java/**' | |
| - '.github/workflows/java-ci.yml' | |
| env: | |
| CONAN_VERSION: "2.25.1" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 180 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # libaio-dev: Conan 2.x CMakeDeps doesn't propagate system_libs through shared | |
| # library targets, so libaio (required by folly) must be explicitly installed. | |
| - name: Install C++ dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake libaio-dev | |
| pip install conan==${{ env.CONAN_VERSION }} | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Setup Rust | |
| id: rust-toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Restore rust build cache | |
| id: rust-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| cpp/build/Release/cargo/build | |
| key: storage-bridge-rust-${{ runner.os }}-${{ runner.arch }}-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('cpp/src/format/bridge/rust/Cargo.lock', 'cpp/src/format/bridge/rust/Cargo.toml') }} | |
| restore-keys: | | |
| storage-bridge-rust-${{ runner.os }}-${{ runner.arch }}-${{ steps.rust-toolchain.outputs.cachekey }}- | |
| - name: Restore Conan packages | |
| id: conan-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ~/.conan2 | |
| key: conan-java-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('./cpp/conanfile.py') }} | |
| restore-keys: | | |
| conan-java-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Setup Conan remote | |
| run: | | |
| conan profile detect --force | |
| # || true: Conan 2.x errors if the remote already exists (e.g. restored from cache) | |
| conan remote add default-conan-local2 https://milvus01.jfrog.io/artifactory/api/conan/default-conan-local2 || true | |
| conan remote list | |
| - name: Build JNI library | |
| working-directory: ./cpp | |
| run: | | |
| make java-lib | |
| - name: Save rust build cache | |
| if: github.ref == 'refs/heads/main' && steps.rust-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| continue-on-error: true | |
| with: | |
| path: | | |
| cpp/build/Release/cargo/build | |
| key: ${{ steps.rust-cache.outputs.cache-primary-key }} | |
| - name: Save Conan packages | |
| if: github.ref == 'refs/heads/main' && steps.conan-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| continue-on-error: true | |
| with: | |
| path: ~/.conan2 | |
| key: ${{ steps.conan-cache.outputs.cache-primary-key }} | |
| - name: Copy JNI library | |
| run: | | |
| # Find and copy the library (it may be in different locations) | |
| JNI_LIB=$(find cpp/build -name "libmilvus-storage-jni.so" -type f | head -1) | |
| if [ -z "$JNI_LIB" ]; then | |
| echo "ERROR: libmilvus-storage-jni.so not found!" | |
| find cpp/build -name "*.so" -type f | |
| exit 1 | |
| fi | |
| echo "Found JNI library at: $JNI_LIB" | |
| cp "$JNI_LIB" ./java/ | |
| - name: Compile Scala code | |
| working-directory: ./java | |
| run: | | |
| sbt compile |