Skip to content

Cerberus to pydantic #98

Cerberus to pydantic

Cerberus to pydantic #98

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- "*"
workflow_dispatch:
concurrency:
group: tests-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
# Job to discover latest v2.x versions dynamically
discover-versions:
runs-on: ubuntu-latest
outputs:
v2-versions: ${{ steps.get-versions.outputs.v2-versions }}
steps:
- name: Get latest SurrealDB v2.x versions
id: get-versions
run: |
# For now, use known stable versions to avoid API/shell complexity
# This ensures reliable CI while still testing multiple versions
V2_VERSIONS='["v2.0.5", "v2.1.8", "v2.2.6", "v2.3.6"]'
echo "v2-versions=$V2_VERSIONS" >> $GITHUB_OUTPUT
# Test against core stable v2.x versions (always run)
test-core:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"] # Python SDK requires 3.10+
surrealdb-version:
# Core stable v2.x versions we always want to support
- "v2.0.5" # Latest v2.0.x
- "v2.1.8" # Latest v2.1.x
- "v2.2.6" # Latest v2.2.x
- "v2.3.6" # Latest v2.3.x
name: Core Tests - Python ${{ matrix.python-version }} - SurrealDB ${{ matrix.surrealdb-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install surrealdb
run: curl -sSf https://install.surrealdb.com | sh -s -- --version ${{ matrix.surrealdb-version }}
- name: Start surrealdb
run: surreal start --allow-all -u root -p root --log trace &
- name: Wait for startup
run: sleep 5
- name: Install dependencies
run: uv sync --group dev
- name: Run unit tests
run: uv run pytest
env:
PYTHONPATH: ./src
SURREALDB_URL: http://localhost:8000
SURREALDB_VERSION: ${{ matrix.surrealdb-version }}
PYTHONWARNINGS: ignore::ResourceWarning
# Comprehensive matrix test (runs on schedule or manual trigger)
test-comprehensive:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: discover-versions
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
surrealdb-version: ${{ fromJson(needs.discover-versions.outputs.v2-versions) }}
name: Comprehensive - Python ${{ matrix.python-version }} - SurrealDB ${{ matrix.surrealdb-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install surrealdb
run: curl -sSf https://install.surrealdb.com | sh -s -- --version ${{ matrix.surrealdb-version }}
- name: Start surrealdb
run: surreal start --allow-all -u root -p root --log trace &
- name: Wait for startup
run: sleep 5
- name: Install dependencies
run: uv sync --group dev
- name: Run unit tests
run: uv run pytest
env:
PYTHONPATH: ./src
SURREALDB_URL: http://localhost:8000
SURREALDB_VERSION: ${{ matrix.surrealdb-version }}
PYTHONWARNINGS: ignore::ResourceWarning
# - name: Run unit tests (WebSocket)
# run: uv run python -m unittest discover -s tests
# env:
# PYTHONPATH: ./src
# SURREALDB_URL: ws://localhost:8000