ci: added rust tests as well #32
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| UV_CACHE_DIR: ${{ github.workspace }}/.cache/uv | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [depot-ubuntu-24.04-4, macos-14, depot-windows-2022-4] | |
| defaults: | |
| run: | |
| working-directory: workspaces/rust/klaw-dbase | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.17" | |
| python-version: "3.13" | |
| - name: Restore uv cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/.cache/uv | |
| key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
| restore-keys: | | |
| uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
| uv-${{ runner.os }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: workspaces/rust/klaw-dbase | |
| - name: Sync dependencies | |
| run: uv sync --package klaw-dbase --group test --no-install-project | |
| - name: Build extension | |
| run: uv run --package klaw-dbase --group test maturin develop --release | |
| - name: Run Python tests | |
| run: uv run --package klaw-dbase --group test pytest -v | |
| - name: Run Rust tests | |
| shell: bash | |
| run: | | |
| PYTHON_LIBDIR=$(uv run python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))") | |
| echo "Python LIBDIR: $PYTHON_LIBDIR" | |
| echo "RUNNER_OS: $RUNNER_OS" | |
| if [[ "$RUNNER_OS" == "Windows" ]]; then | |
| export PATH="$(dirname $(uv run python -c 'import sys; print(sys.executable)')):$PATH" | |
| elif [[ "$RUNNER_OS" == "macOS" ]]; then | |
| export DYLD_LIBRARY_PATH="$PYTHON_LIBDIR" | |
| else | |
| export LD_LIBRARY_PATH="$PYTHON_LIBDIR" | |
| fi | |
| echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" | |
| uv run --package klaw-dbase --group test cargo test --release | |
| - name: Minimize uv cache | |
| run: uv cache prune --ci |