Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 48 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
Expand All @@ -24,9 +27,25 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
- name: Install core dependencies
run: uv sync --extra dev

- name: Check core import without DAX extra
run: |
uv run python - <<'PY'
import sys

from sidemantic import Dimension, Metric, Model

assert Model.__name__ == "Model"
assert Dimension.__name__ == "Dimension"
assert Metric.__name__ == "Metric"
assert "sidemantic_dax" not in sys.modules
PY

- name: Install DAX dependencies
run: uv sync --extra dev --extra dax

- name: Check version consistency
run: |
PYPROJECT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
Expand All @@ -46,6 +65,18 @@ jobs:
- name: Run tests
run: uv run pytest -v

- name: Run installed-wheel DAX smoke
run: |
uv build crates/dax-pyo3 --out-dir /tmp/sidemantic-dax-dist
uv build --out-dir /tmp/sidemantic-dist
SIDEMANTIC_WHEEL=$(realpath "$(find /tmp/sidemantic-dist -name 'sidemantic-[0-9]*.whl' -print -quit)")
cd /tmp
uv run --no-project --find-links /tmp/sidemantic-dax-dist --with "${SIDEMANTIC_WHEEL}[dax]" -- python - <<'PY'
import sidemantic_dax

sidemantic_dax.parse_expression("1")
PY

update-schema:
name: Update JSON Schema
needs: python
Expand All @@ -58,6 +89,9 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
Expand All @@ -67,7 +101,7 @@ jobs:
run: uv python install 3.12

- name: Install dependencies
run: uv sync --extra dev
run: uv sync --extra dev --extra dax

- name: Generate and commit schema if needed
run: |
Expand All @@ -93,19 +127,22 @@ jobs:
with:
filters: |
rust:
- 'crates/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'sidemantic-rs/**'
- 'tests/dax/fixtures/**'
duckdb:
- 'sidemantic-duckdb/**'
- 'sidemantic-rs/**'
- 'Cargo.toml'
- 'Cargo.lock'

rust:
name: Rust (sidemantic-rs)
name: Rust
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
Expand All @@ -116,16 +153,16 @@ jobs:
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: sidemantic-rs
workspaces: .

- name: Run cargo fmt check
run: cargo fmt --check

- name: Run cargo clippy
run: cargo clippy -- -D warnings
run: cargo clippy -p sidemantic -p dax-parser -p dax-pyo3 --all-targets -- -D warnings

- name: Run cargo test
run: cargo test
run: cargo test -p sidemantic -p dax-parser -p dax-pyo3
env:
RUST_MIN_STACK: 16777216

Expand Down Expand Up @@ -155,7 +192,7 @@ jobs:
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: sidemantic-rs
workspaces: .

- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y ninja-build
Expand Down
195 changes: 168 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,13 @@ on:
- major

jobs:
publish:
version:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write

outputs:
current_version: ${{ steps.get_version.outputs.current_version }}
new_version: ${{ steps.version.outputs.new_version }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
run: uv python install 3.12

- name: Get current version
id: get_version
Expand Down Expand Up @@ -59,39 +50,189 @@ jobs:

NEW_VERSION="$MAJOR.$MINOR.$PATCH"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV

build-dax-wheels:
needs: version
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
run: uv python install 3.12

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Update DAX package version
shell: bash
env:
NEW_VERSION: ${{ needs.version.outputs.new_version }}
run: |
uv run --no-project python - <<'PY'
import os
from pathlib import Path

version = os.environ["NEW_VERSION"]

for path in (
Path("crates/dax-pyo3/pyproject.toml"),
Path("crates/dax-pyo3/Cargo.toml"),
):
lines = path.read_text().splitlines()
path.write_text(
"\n".join(
f'version = "{version}"' if line.startswith("version = ") else line
for line in lines
)
+ "\n"
)
PY

- name: Build DAX wheel
run: uv build crates/dax-pyo3 --wheel --out-dir dist

- name: Smoke test DAX wheel
shell: bash
run: |
DAX_WHEEL=$(find dist -name 'sidemantic_dax-*.whl' -print -quit)
uv run --no-project --with "$DAX_WHEEL" -- python - <<'PY'
import sidemantic_dax

sidemantic_dax.parse_expression("1")
PY

- name: Upload DAX wheel
uses: actions/upload-artifact@v4
with:
name: dax-wheel-${{ matrix.os }}
path: dist/*.whl

publish:
needs: [version, build-dax-wheels]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
run: uv python install 3.12

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Update version in pyproject.toml and __init__.py
shell: bash
env:
NEW_VERSION: ${{ needs.version.outputs.new_version }}
run: |
sed -i 's/^version = .*/version = "${{ steps.version.outputs.new_version }}"/' pyproject.toml
sed -i 's/^__version__ = .*/__version__ = "${{ steps.version.outputs.new_version }}"/' sidemantic/__init__.py
echo "Updated version to ${{ steps.version.outputs.new_version }}"
uv run --no-project python - <<'PY'
import os
from pathlib import Path

version = os.environ["NEW_VERSION"]

version_files = (
Path("pyproject.toml"),
Path("crates/dax-pyo3/pyproject.toml"),
Path("crates/dax-pyo3/Cargo.toml"),
)
for path in version_files:
lines = path.read_text().splitlines()
path.write_text(
"\n".join(
f'version = "{version}"' if line.startswith("version = ") else line
for line in lines
)
+ "\n"
)

init_path = Path("sidemantic/__init__.py")
init_lines = init_path.read_text().splitlines()
init_path.write_text(
"\n".join(
f'__version__ = "{version}"' if line.startswith("__version__ = ") else line
for line in init_lines
)
+ "\n"
)

pyproject_path = Path("pyproject.toml")
pyproject_lines = pyproject_path.read_text().splitlines()
pyproject_path.write_text(
"\n".join(
f' "sidemantic-dax>={version}",' if line.strip().startswith('"sidemantic-dax>=')
else line
for line in pyproject_lines
)
+ "\n"
)
PY
echo "Updated version to $NEW_VERSION"

- name: Update lock file
run: uv lock
run: |
cargo generate-lockfile
uv lock

- name: Download DAX wheels
uses: actions/download-artifact@v4
with:
pattern: dax-wheel-*
path: dist
merge-multiple: true

- name: Build packages
run: |
uv build crates/dax-pyo3 --sdist --out-dir dist
uv build --out-dir dist

- name: Run installed-wheel DAX smoke
run: |
DIST_DIR=$(realpath dist)
SIDEMANTIC_WHEEL=$(realpath "$(find dist -name 'sidemantic-[0-9]*.whl' -print -quit)")
cd /tmp
uv run --no-project --find-links "${DIST_DIR}" --with "${SIDEMANTIC_WHEEL}[dax]" -- python - <<'PY'
import sidemantic_dax

- name: Build package
run: uv build
sidemantic_dax.parse_expression("1")
PY

- name: Publish to PyPI
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish --token $UV_PUBLISH_TOKEN
run: uv publish dist/* --token $UV_PUBLISH_TOKEN

- name: Commit version bump and create tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pyproject.toml sidemantic/__init__.py uv.lock
git commit -m "Bump version to ${{ steps.version.outputs.new_version }}"
git tag -a "v${{ steps.version.outputs.new_version }}" -m "Release v${{ steps.version.outputs.new_version }}"
git add pyproject.toml sidemantic/__init__.py crates/dax-pyo3/pyproject.toml crates/dax-pyo3/Cargo.toml Cargo.lock uv.lock
git commit -m "Bump version to ${{ needs.version.outputs.new_version }}"
git tag -a "v${{ needs.version.outputs.new_version }}" -m "Release v${{ needs.version.outputs.new_version }}"
git push origin main
git push origin "v${{ steps.version.outputs.new_version }}"
git push origin "v${{ needs.version.outputs.new_version }}"

- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.version.outputs.new_version }}" \
--title "v${{ steps.version.outputs.new_version }}" \
gh release create "v${{ needs.version.outputs.new_version }}" \
--title "v${{ needs.version.outputs.new_version }}" \
--generate-notes
8 changes: 7 additions & 1 deletion .github/workflows/pyodide-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ jobs:

console.log('Testing basic imports...');
await pyodide.runPythonAsync(`
from sidemantic import Model, Dimension, Metric, Relationship
from sidemantic import Model, Dimension, Metric, Relationship, SemanticLayer
from sidemantic.core.semantic_graph import SemanticGraph
from sidemantic.loaders import load_from_directory
print('✓ Core imports successful')

# Test creating a model (doesn't need duckdb)
Expand All @@ -88,6 +89,11 @@ jobs:
graph.add_model(model)
print('✓ SemanticGraph successful')

layer = SemanticLayer()
layer.graph.add_model(model)
assert callable(load_from_directory)
print('✓ SemanticLayer and loader imports successful')

print('All Pyodide imports and basic operations work!')
`);
}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ examples/juv.tmp*.py
# Package installers
*.pkg
.claude/settings.local.json
crates/dax-pyo3/python/sidemantic_dax/_native*.so

# Docker volumes
docker-compose.override.yml
Expand Down
Loading
Loading