-
Notifications
You must be signed in to change notification settings - Fork 1
add ci. #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add ci. #2
Changes from all commits
17b4080
b632569
1c4842d
5fabbdb
bb0d374
9853ff3
40ae111
b06cc1d
7b262c0
c790f02
2f808fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,251 @@ | ||||||||||||||||||||||||
| name: CI | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||
| branches: [ main ] | ||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||
| branches: [ main ] | ||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| CARGO_TERM_COLOR: always | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||
| test: | ||||||||||||||||||||||||
| name: Test ${{ matrix.os }} (${{ matrix.arch }}) - XGBoost ${{ matrix.xgboost_version }} | ||||||||||||||||||||||||
| runs-on: ${{ matrix.runner }} | ||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||
| include: | ||||||||||||||||||||||||
| # macOS ARM64 (M1/M2/M3) - Test multiple versions | ||||||||||||||||||||||||
| - os: macos | ||||||||||||||||||||||||
| arch: arm64 | ||||||||||||||||||||||||
| runner: macos-14 | ||||||||||||||||||||||||
| xgboost_version: "3.1.1" | ||||||||||||||||||||||||
| - os: macos | ||||||||||||||||||||||||
| arch: arm64 | ||||||||||||||||||||||||
| runner: macos-14 | ||||||||||||||||||||||||
| xgboost_version: "3.0.5" | ||||||||||||||||||||||||
| - os: macos | ||||||||||||||||||||||||
| arch: arm64 | ||||||||||||||||||||||||
| runner: macos-14 | ||||||||||||||||||||||||
| xgboost_version: "2.1.4" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # macOS x86_64 (Intel) | ||||||||||||||||||||||||
| - os: macos | ||||||||||||||||||||||||
| arch: x86_64 | ||||||||||||||||||||||||
| runner: macos-15-large | ||||||||||||||||||||||||
| xgboost_version: "3.1.1" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Linux x86_64 - Test multiple versions including thread-safety boundary | ||||||||||||||||||||||||
| - os: linux | ||||||||||||||||||||||||
| arch: x86_64 | ||||||||||||||||||||||||
| runner: ubuntu-latest | ||||||||||||||||||||||||
| xgboost_version: "3.1.1" | ||||||||||||||||||||||||
| - os: linux | ||||||||||||||||||||||||
| arch: x86_64 | ||||||||||||||||||||||||
| runner: ubuntu-latest | ||||||||||||||||||||||||
| xgboost_version: "1.7.6" | ||||||||||||||||||||||||
| - os: linux | ||||||||||||||||||||||||
| arch: x86_64 | ||||||||||||||||||||||||
| runner: ubuntu-latest | ||||||||||||||||||||||||
| xgboost_version: "1.4.2" # First thread-safe version | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Linux ARM64 | ||||||||||||||||||||||||
| - os: linux | ||||||||||||||||||||||||
| arch: arm64 | ||||||||||||||||||||||||
| runner: ubuntu-latest | ||||||||||||||||||||||||
| xgboost_version: "3.1.1" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
+55
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix linux arm64 runner selection Setting - - os: linux
- arch: arm64
- runner: ubuntu-latest
+ - os: linux
+ arch: arm64
+ runner: ubuntu-24.04-arm📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| # Windows x86_64 | ||||||||||||||||||||||||
| - os: windows | ||||||||||||||||||||||||
| arch: x86_64 | ||||||||||||||||||||||||
| runner: windows-latest | ||||||||||||||||||||||||
| xgboost_version: "3.1.1" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install Rust | ||||||||||||||||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Cache cargo registry | ||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| path: ~/.cargo/registry | ||||||||||||||||||||||||
| key: ${{ runner.os }}-${{ matrix.arch }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | ||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||
| ${{ runner.os }}-${{ matrix.arch }}-cargo-registry- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Cache cargo index | ||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| path: ~/.cargo/git | ||||||||||||||||||||||||
| key: ${{ runner.os }}-${{ matrix.arch }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | ||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||
| ${{ runner.os }}-${{ matrix.arch }}-cargo-index- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Cache cargo build | ||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| path: target | ||||||||||||||||||||||||
| key: ${{ runner.os }}-${{ matrix.arch }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | ||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||
| ${{ runner.os }}-${{ matrix.arch }}-cargo-build-target- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install system dependencies (Linux) | ||||||||||||||||||||||||
| if: matrix.os == 'linux' | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| sudo apt-get update | ||||||||||||||||||||||||
| sudo apt-get install -y libclang-dev | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install system dependencies (macOS) | ||||||||||||||||||||||||
| if: matrix.os == 'macos' | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| brew install libomp | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Check build (no features) | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: ${{ matrix.xgboost_version }} | ||||||||||||||||||||||||
| run: cargo check --verbose | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Build (no features) | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: ${{ matrix.xgboost_version }} | ||||||||||||||||||||||||
| run: cargo build --verbose | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Run tests (no features) | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: ${{ matrix.xgboost_version }} | ||||||||||||||||||||||||
| run: cargo test --verbose | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Build examples | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: ${{ matrix.xgboost_version }} | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| cargo build --example basic_usage --verbose | ||||||||||||||||||||||||
| cargo build --example advanced_usage --verbose | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Verify library architecture (macOS) | ||||||||||||||||||||||||
| if: matrix.os == 'macos' | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| echo "Checking library architecture..." | ||||||||||||||||||||||||
| file target/debug/libxgboost.dylib | ||||||||||||||||||||||||
| lipo -info target/debug/libxgboost.dylib || otool -L target/debug/libxgboost.dylib | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Verify library architecture (Linux) | ||||||||||||||||||||||||
| if: matrix.os == 'linux' | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| echo "Checking library architecture..." | ||||||||||||||||||||||||
| file target/debug/libxgboost.so | ||||||||||||||||||||||||
| readelf -h target/debug/libxgboost.so | grep Machine | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Verify library exists (Windows) | ||||||||||||||||||||||||
| if: matrix.os == 'windows' | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| echo "Checking library exists..." | ||||||||||||||||||||||||
| Get-Item target/debug/xgboost.dll | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Verify thread safety detection | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: ${{ matrix.xgboost_version }} | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| echo "XGBoost version: ${{ matrix.xgboost_version }}" | ||||||||||||||||||||||||
| cargo build --verbose 2>&1 | grep "thread-safe" || echo "No thread-safe message found" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| clippy: | ||||||||||||||||||||||||
| name: Clippy | ||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install Rust | ||||||||||||||||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| components: clippy | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install system dependencies | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| sudo apt-get update | ||||||||||||||||||||||||
| sudo apt-get install -y libclang-dev | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Run clippy (no features) | ||||||||||||||||||||||||
| run: cargo clippy -- -D warnings | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| fmt: | ||||||||||||||||||||||||
| name: Format | ||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install Rust | ||||||||||||||||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| components: rustfmt | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Check formatting | ||||||||||||||||||||||||
| run: cargo fmt -- --check | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Test checksum verification | ||||||||||||||||||||||||
| security-checksums: | ||||||||||||||||||||||||
| name: Verify SHA256 checksums | ||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install Rust | ||||||||||||||||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install system dependencies | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| sudo apt-get update | ||||||||||||||||||||||||
| sudo apt-get install -y libclang-dev | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Test checksum verification for XGBoost 3.1.1 | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: "3.1.1" | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| cargo check --verbose 2>&1 | tee build.log | ||||||||||||||||||||||||
| grep "✓ Verified SHA256" build.log | ||||||||||||||||||||||||
| echo "Checksum verification working for 3.1.1" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Test checksum verification for XGBoost 2.1.4 | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: "2.1.4" | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| cargo clean | ||||||||||||||||||||||||
| cargo check --verbose 2>&1 | tee build.log | ||||||||||||||||||||||||
| grep "✓ Verified SHA256" build.log | ||||||||||||||||||||||||
| echo "Checksum verification working for 2.1.4" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Test caching behavior | ||||||||||||||||||||||||
| caching-test: | ||||||||||||||||||||||||
| name: Test wheel caching | ||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install Rust | ||||||||||||||||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install system dependencies | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| sudo apt-get update | ||||||||||||||||||||||||
| sudo apt-get install -y libclang-dev | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: First build (should download) | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: "3.1.1" | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| cargo check --verbose 2>&1 | tee build1.log | ||||||||||||||||||||||||
| grep "Downloading XGBoost wheel" build1.log || true | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Second build (should use cache) | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| XGBOOST_VERSION: "3.1.1" | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| touch src/lib.rs | ||||||||||||||||||||||||
| cargo check --verbose 2>&1 | tee build2.log | ||||||||||||||||||||||||
| grep "Using cached XGBoost library" build2.log | ||||||||||||||||||||||||
| echo "Caching is working correctly" | ||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /target | ||
| Cargo.lock | ||
| *.json | ||
| *.bin | ||
| *.model | ||
| *.dylib | ||
| *.so | ||
| *.dll |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [package] | ||
| name = "xgboost-rust" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| description = "Rust bindings for XGBoost, a gradient boosting library for machine learning. Downloads XGBoost binaries at build time for cross-platform compatibility." | ||
| license = "Apache-2.0" | ||
| keywords = ["machine-learning", "gradient-boosting", "xgboost", "ml"] | ||
| categories = ["science"] | ||
| readme = "README.md" | ||
| rust-version = "1.70" | ||
|
|
||
| [build-dependencies] | ||
| bindgen = "0.72.0" | ||
| ureq = "2.0" | ||
| zip = "0.6" | ||
| sha2 = "0.10" | ||
|
|
||
| [features] | ||
| default = [] | ||
| gpu = [] | ||
|
|
||
| [[example]] | ||
| name = "basic_usage" | ||
| path = "examples/basic_usage.rs" | ||
|
|
||
| [[example]] | ||
| name = "advanced_usage" | ||
| path = "examples/advanced_usage.rs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch off paid macOS large runner
macos-15-largetargets a paid larger runner that only works when the repository belongs to an organization with the larger-runner entitlement; on a personal/open-source repo this job will fail before any step runs.(docs.github.com) Please move to the standard Intel label (for examplemacos-15-intel) so the Intel coverage remains but the workflow still executes.📝 Committable suggestion
🤖 Prompt for AI Agents