Improve the API and update the tests #8
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: Infera Extension CI | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Set up Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Cache Cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| infera/target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Model size guard (<= 10KB) | |
| run: | | |
| FILE=tests/models/linear.onnx | |
| if [ ! -f "$FILE" ]; then echo "Missing $FILE"; exit 1; fi | |
| SIZE=$(stat -c%s "$FILE") | |
| if [ "$SIZE" -gt 10240 ]; then | |
| echo "Model file $FILE too large: ${SIZE} bytes (limit 10240)" >&2 | |
| exit 1 | |
| fi | |
| echo "Model file size OK: ${SIZE} bytes" | |
| - name: Install Python dependencies (minimal) | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[dev] | |
| - name: Build & Test Extension | |
| env: | |
| MAKEFLAGS: -j2 | |
| run: | | |
| make test-extension | |
| - name: Archive build artifacts (DuckDB + extension) | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: duckdb-infera-build | |
| path: | | |
| build/release/duckdb | |
| build/release/*.so | |
| build/release/*.a | |
| infera/target/release/*.rlib | |
| infera/target/release/libinfera* | |
| retention-days: 7 | |
| - name: Simple model roundtrip smoke (redundant guard) | |
| run: | | |
| ./build/release/duckdb -c "LOAD infera; SELECT load_onnx_model('linear','tests/models/linear.onnx'); SELECT onnx_predict('linear',1.0,2.0,3.0); SELECT model_metadata('linear'); SELECT unload_onnx_model('linear');" |