Skip to content

feat: add subscribeChanges WebSocket endpoint for real-time change streaming #55

feat: add subscribeChanges WebSocket endpoint for real-time change streaming

feat: add subscribeChanges WebSocket endpoint for real-time change streaming #55

Workflow file for this run

name: CI
on:
push:
branches: [main, develop, "release/**"]
pull_request:
branches: [main, develop]
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- run: uv sync --dev
- run: uv run ruff check src/ tests/
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- run: uv python install ${{ matrix.python-version }}
- run: uv sync --dev --python ${{ matrix.python-version }}
- run: uv run pytest --cov=atdata_app --cov-report=term-missing
schema-check:
runs-on: ubuntu-latest
strategy:
matrix:
postgres-version: ["15", "16", "17"]
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: atdata_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Apply schema
env:
PGHOST: localhost
PGUSER: test
PGPASSWORD: test
PGDATABASE: atdata_test
run: psql -v ON_ERROR_STOP=1 -f src/atdata_app/sql/schema.sql
- name: Smoke test
env:
PGHOST: localhost
PGUSER: test
PGPASSWORD: test
PGDATABASE: atdata_test
run: |
psql -v ON_ERROR_STOP=1 <<'SQL'
INSERT INTO schemas (did, rkey, name, version, schema_type, schema_body, created_at)
VALUES ('did:plc:test', 'com.example.test@1.0.0', 'Test Schema', '1.0.0', 'jsonSchema', '{}'::jsonb, '2024-01-01T00:00:00Z');
INSERT INTO entries (did, rkey, name, schema_ref, storage, created_at)
VALUES ('did:plc:test', '3jqfcqzm3fp2k', 'Test Dataset',
'at://did:plc:test/science.alt.dataset.schema/com.example.test@1.0.0',
'{"$type": "science.alt.dataset.entry#httpStorage", "url": "https://example.com/data.csv"}'::jsonb,
'2024-01-01T00:00:00Z');
SELECT name FROM entries WHERE search_tsv @@ plainto_tsquery('english'::regconfig, 'Test');
SQL
echo "Schema validation and smoke test passed on PostgreSQL ${{ matrix.postgres-version }}"
integration-test:
runs-on: ubuntu-latest
strategy:
matrix:
postgres-version: ["15", "16", "17"]
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: atdata_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- run: uv sync --dev
- name: Run integration tests
env:
TEST_DATABASE_URL: postgresql://test:test@localhost:5432/atdata_test
run: uv run pytest tests/test_integration.py -v