Add Yardstick adapter and SQL rewrite parity (#104) #589
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: | |
| jobs: | |
| python: | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Check version consistency | |
| run: | | |
| PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| INIT_VERSION=$(grep '^__version__ = ' sidemantic/__init__.py | sed 's/__version__ = "\(.*\)"/\1/') | |
| if [ "$PYPROJECT_VERSION" != "$INIT_VERSION" ]; then | |
| echo "Version mismatch: pyproject.toml=$PYPROJECT_VERSION, __init__.py=$INIT_VERSION" | |
| exit 1 | |
| fi | |
| echo "Version check passed: $PYPROJECT_VERSION" | |
| - name: Run ruff check | |
| run: uv run ruff check . --exclude docs/_extensions --exclude sidemantic-duckdb/extension-ci-tools --exclude sidemantic-duckdb/scripts --exclude sidemantic-duckdb/duckdb --exclude sidemantic/adapters/malloy_grammar --exclude sidemantic/adapters/holistics_grammar | |
| - name: Run ruff format check | |
| run: uv run ruff format --check . --exclude docs/_extensions --exclude sidemantic-duckdb/extension-ci-tools --exclude sidemantic-duckdb/scripts --exclude sidemantic-duckdb/duckdb --exclude sidemantic/adapters/malloy_grammar --exclude sidemantic/adapters/holistics_grammar | |
| - name: Run tests | |
| run: uv run pytest -v --cov=sidemantic --cov-report=term-missing | |
| update-schema: | |
| name: Update JSON Schema | |
| needs: python | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --extra dev | |
| - name: Generate and commit schema if needed | |
| run: | | |
| uv run python scripts/generate_schema.py | |
| if ! git diff --exit-code sidemantic-schema.json; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add sidemantic-schema.json | |
| git commit -m "Auto-update JSON schema" | |
| git push | |
| fi | |
| check-rust-changes: | |
| name: Check Rust/DuckDB changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| rust_changed: ${{ steps.changes.outputs.rust }} | |
| duckdb_changed: ${{ steps.changes.outputs.duckdb }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: | | |
| rust: | |
| - 'sidemantic-rs/**' | |
| duckdb: | |
| - 'sidemantic-duckdb/**' | |
| - 'sidemantic-rs/**' | |
| rust: | |
| name: Rust (sidemantic-rs) | |
| needs: check-rust-changes | |
| if: needs.check-rust-changes.outputs.rust_changed == 'true' | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: sidemantic-rs | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: sidemantic-rs | |
| - name: Run cargo fmt check | |
| run: cargo fmt --check | |
| - name: Run cargo clippy | |
| run: cargo clippy -- -D warnings | |
| - name: Run cargo test | |
| run: cargo test | |
| env: | |
| RUST_MIN_STACK: 16777216 | |
| duckdb-extension: | |
| name: DuckDB Extension | |
| needs: check-rust-changes | |
| if: needs.check-rust-changes.outputs.duckdb_changed == 'true' | |
| runs-on: ubuntu-latest | |
| env: | |
| GEN: ninja | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Clone DuckDB dependencies | |
| working-directory: sidemantic-duckdb | |
| run: | | |
| # These are listed as submodules in .gitmodules but aren't tracked properly | |
| # Clone them directly at the commits the extension was built against | |
| rm -rf duckdb extension-ci-tools | |
| git clone --depth 1 --branch v1.4.2 https://github.com/duckdb/duckdb.git duckdb | |
| git clone --depth 1 --branch v1.4.2 https://github.com/duckdb/extension-ci-tools.git extension-ci-tools | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: sidemantic-rs | |
| - name: Install build dependencies | |
| run: sudo apt-get update && sudo apt-get install -y ninja-build | |
| - name: Build Rust library | |
| working-directory: sidemantic-rs | |
| run: cargo build --release | |
| - name: Build DuckDB extension | |
| working-directory: sidemantic-duckdb | |
| run: make | |
| - name: Run extension tests | |
| working-directory: sidemantic-duckdb | |
| run: make test |