Skip to content

ci: notify cookbook smoke tests on release #283

ci: notify cookbook smoke tests on release

ci: notify cookbook smoke tests on release #283

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
doc-lint:
name: Documentation lint
uses: cubrid-lab/.github/.github/workflows/doc-lint.yml@main
with:
exclude: "node_modules/,vendor/"
fail-on-issue: false # advisory mode during initial rollout
# ──────────────────────────────────────────
# Job 1: Lint (fast, no DB needed)
# ──────────────────────────────────────────
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install pinned ruff from pyproject.toml
run: pip install -e ".[dev]"
- name: Ruff check
run: ruff check sqlalchemy_cubrid/ test/
- name: Ruff format check
run: ruff format --check sqlalchemy_cubrid/ test/
# ──────────────────────────────────────────
# Job 2: Offline tests (no DB needed)
# ──────────────────────────────────────────
offline-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pip install pytest-cov alembic tomli
- name: Run offline tests with coverage
run: |
python -m pytest \
test/ \
--ignore=test/test_integration.py \
--ignore=test/test_suite.py \
--ignore=test/test_aio_integration.py \
-v --tb=short \
--cov=sqlalchemy_cubrid \
--cov-report=term-missing \
--cov-fail-under=95
- name: Upload coverage
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: .coverage
sqlalchemy-22-canary:
runs-on: ubuntu-latest
continue-on-error: true # Canary: warn, don't gate. SA pre-releases may break.
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install dependencies with SQLAlchemy pre-release
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pip install --pre "sqlalchemy>=2.2.0b1,<2.3"
- name: Run offline tests (canary)
run: |
python -m pytest \
test/ \
--ignore=test/test_integration.py \
--ignore=test/test_suite.py \
--ignore=test/test_aio_integration.py \
-v --tb=short
packaging-smoke-test:
runs-on: ubuntu-latest
needs: [offline-tests]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install build tool
run: |
python -m pip install --upgrade pip
pip install build
- name: Build sdist and wheel
run: python -m build
- name: Smoke test wheel install
run: |
python -m venv /tmp/test-wheel
/tmp/test-wheel/bin/pip install dist/*.whl
cd /tmp
/tmp/test-wheel/bin/python -c "import sqlalchemy_cubrid; print(sqlalchemy_cubrid.__version__)"
/tmp/test-wheel/bin/python -c "from sqlalchemy_cubrid import insert, merge, JSON, SET"
/tmp/test-wheel/bin/python -c "import importlib.metadata; eps = {ep.name: ep for ep in importlib.metadata.entry_points(group='sqlalchemy.dialects') if ep.name.startswith('cubrid')}; assert 'cubrid' in eps, f'Missing cubrid entry point, found: {list(eps.keys())}'; assert 'cubrid.cubrid' in eps; assert 'cubrid.pycubrid' in eps; assert 'cubrid.aiopycubrid' in eps; print(f'Found {len(eps)} dialect entry points'); [print(f' {name} -> {ep.load().__module__}.{ep.load().__name__}') for name, ep in sorted(eps.items())]"
/tmp/test-wheel/bin/pip install alembic
/tmp/test-wheel/bin/python -c "import importlib.metadata; eps = {ep.name: ep for ep in importlib.metadata.entry_points(group='alembic.ddl') if ep.name == 'cubrid'}; assert 'cubrid' in eps; cls = eps['cubrid'].load(); print(f'alembic.ddl cubrid -> {cls.__module__}.{cls.__name__}')"
/tmp/test-wheel/bin/python -c "import pathlib, sqlalchemy_cubrid; pkg_dir = pathlib.Path(sqlalchemy_cubrid.__file__).parent; assert (pkg_dir / 'py.typed').exists(), 'py.typed marker missing'; print('py.typed marker: OK')"
- name: Smoke test sdist install
run: |
python -m venv /tmp/test-sdist
/tmp/test-sdist/bin/pip install dist/*.tar.gz
cd /tmp
/tmp/test-sdist/bin/python -c "import sqlalchemy_cubrid; print(sqlalchemy_cubrid.__version__)"
integration-tests:
runs-on: ubuntu-latest
needs: [lint, offline-tests, packaging-smoke-test]
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.14"]
cubrid-version: ["11.4", "11.2", "11.0", "10.2"]
services:
cubrid:
image: cubrid/cubrid:${{ matrix.cubrid-version }}
env:
CUBRID_DB: testdb
ports:
- 33000:33000
options: >-
--health-cmd "csql -u dba testdb -c 'SELECT 1'"
--health-interval 15s
--health-timeout 10s
--health-retries 10
--health-start-period 30s
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
- name: Build and install CUBRID Python driver
run: |
git clone --branch v11.3.0.51 --depth 1 --recurse-submodules \
https://github.com/CUBRID/cubrid-python.git /tmp/cubrid-python
cd /tmp/cubrid-python
# Build CCI library
mkdir -p cci-src/build_x86_64_release
cd cci-src/build_x86_64_release
cmake ../
make -j$(nproc)
cd /tmp/cubrid-python
# Patch build_cci.sh to skip rebuild
echo '#!/bin/bash' > build_cci.sh
echo 'exit 0' >> build_cci.sh
chmod +x build_cci.sh
pip install .
- name: Install project
run: |
pip install -e ".[dev]"
pip install pytest-cov
- name: Wait for CUBRID to be ready
run: |
for i in $(seq 1 30); do
if python -c "
import CUBRIDdb
try:
conn = CUBRIDdb.connect('CUBRID:localhost:33000:testdb:::', 'dba', '')
cur = conn.cursor()
cur.execute('SELECT 1')
cur.close()
conn.close()
print('CUBRID ready')
exit(0)
except Exception as e:
print(f'Attempt $i: {e}')
exit(1)
"; then
break
fi
echo "Waiting for CUBRID... (attempt $i/30)"
sleep 5
done
- name: Run integration tests
env:
CUBRID_TEST_URL: "cubrid://dba@localhost:33000/testdb"
run: |
python -m pytest test/test_integration.py -v --tb=short
- name: Run async integration tests
env:
CUBRID_TEST_URL: "cubrid://dba@localhost:33000/testdb"
run: |
pip install pycubrid pytest-asyncio
python -m pytest test/test_aio_integration.py -v --tb=short
matrix-result:
if: always()
runs-on: ubuntu-latest
needs: [lint, offline-tests, packaging-smoke-test, integration-tests]
steps:
- name: Check results
run: |
echo "## CI Matrix Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Lint | ${{ needs.lint.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Offline Tests | ${{ needs.offline-tests.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Packaging Smoke Test | ${{ needs.packaging-smoke-test.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Integration Tests | ${{ needs.integration-tests.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Compatibility Matrix" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| | Python 3.10 | Python 3.11 | Python 3.12 | Python 3.13 | Python 3.14 |" >> $GITHUB_STEP_SUMMARY
echo "|---|---|---|---|---|---|" >> $GITHUB_STEP_SUMMARY
echo "| **Offline Tests** | ✅ | ✅ | ✅ | ✅ | ✅ |" >> $GITHUB_STEP_SUMMARY
echo "| **CUBRID 11.4** | 🔄 | — | — | — | 🔄 |" >> $GITHUB_STEP_SUMMARY
echo "| **CUBRID 11.2** | 🔄 | — | — | — | 🔄 |" >> $GITHUB_STEP_SUMMARY
echo "| **CUBRID 11.0** | 🔄 | — | — | — | 🔄 |" >> $GITHUB_STEP_SUMMARY
echo "| **CUBRID 10.2** | 🔄 | — | — | — | 🔄 |" >> $GITHUB_STEP_SUMMARY
- name: Fail if required jobs failed
if: >-
needs.lint.result == 'failure' ||
needs.offline-tests.result == 'failure' ||
needs.packaging-smoke-test.result == 'failure' ||
needs.integration-tests.result == 'failure'
run: exit 1