mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
36e67e6eec
Signed-off-by: phernandez <paul@basicmachines.co>
322 lines
7.2 KiB
YAML
322 lines
7.2 KiB
YAML
name: Tests
|
|
|
|
concurrency:
|
|
group: bm-ci-${{ github.workflow }}-${{ github.repository }}-${{ github.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
static-checks:
|
|
name: Static Checks (Python 3.12)
|
|
timeout-minutes: 20
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.12"
|
|
cache: "pip"
|
|
|
|
- name: Install uv
|
|
run: |
|
|
pip install uv
|
|
|
|
- uses: extractions/setup-just@v3
|
|
|
|
- name: Create virtual env
|
|
run: |
|
|
uv venv
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv pip install -e ".[dev]"
|
|
|
|
- name: Run type checks
|
|
run: |
|
|
just typecheck
|
|
|
|
- name: Run linting
|
|
run: |
|
|
just lint
|
|
|
|
test-sqlite-unit:
|
|
name: Test SQLite Unit (${{ matrix.os }}, Python ${{ matrix.python-version }})
|
|
timeout-minutes: 30
|
|
needs: [static-checks]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
python-version: "3.12"
|
|
- os: ubuntu-latest
|
|
python-version: "3.13"
|
|
- os: ubuntu-latest
|
|
python-version: "3.14"
|
|
- os: windows-latest
|
|
python-version: "3.12"
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: 'pip'
|
|
|
|
- name: Install uv
|
|
run: |
|
|
pip install uv
|
|
|
|
- uses: extractions/setup-just@v3
|
|
|
|
- name: Create virtual env
|
|
run: |
|
|
uv venv
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv pip install -e ".[dev]"
|
|
|
|
- name: Run tests (SQLite Unit)
|
|
run: |
|
|
just test-unit-sqlite
|
|
|
|
test-sqlite-integration:
|
|
name: Test SQLite Integration (${{ matrix.os }}, Python ${{ matrix.python-version }})
|
|
timeout-minutes: 45
|
|
needs: [static-checks]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
python-version: "3.12"
|
|
- os: ubuntu-latest
|
|
python-version: "3.13"
|
|
- os: ubuntu-latest
|
|
python-version: "3.14"
|
|
- os: windows-latest
|
|
python-version: "3.12"
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: 'pip'
|
|
|
|
- name: Install uv
|
|
run: |
|
|
pip install uv
|
|
|
|
- uses: extractions/setup-just@v3
|
|
|
|
- name: Create virtual env
|
|
run: |
|
|
uv venv
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv pip install -e ".[dev]"
|
|
|
|
- name: Run tests (SQLite Integration)
|
|
run: |
|
|
just test-int-sqlite
|
|
|
|
test-postgres-unit:
|
|
name: Test Postgres Unit (Python ${{ matrix.python-version }})
|
|
timeout-minutes: 30
|
|
needs: [static-checks]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: [ "3.12", "3.13", "3.14" ]
|
|
runs-on: ubuntu-latest
|
|
|
|
# Note: No services section needed - testcontainers handles Postgres in Docker
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: 'pip'
|
|
|
|
- name: Install uv
|
|
run: |
|
|
pip install uv
|
|
|
|
- uses: extractions/setup-just@v3
|
|
|
|
- name: Create virtual env
|
|
run: |
|
|
uv venv
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv pip install -e ".[dev]"
|
|
|
|
- name: Run tests (Postgres Unit)
|
|
run: |
|
|
just test-unit-postgres
|
|
|
|
test-postgres-integration:
|
|
name: Test Postgres Integration (Python ${{ matrix.python-version }})
|
|
timeout-minutes: 45
|
|
needs: [static-checks]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: [ "3.12", "3.13", "3.14" ]
|
|
runs-on: ubuntu-latest
|
|
|
|
# Note: No services section needed - testcontainers handles Postgres in Docker
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: 'pip'
|
|
|
|
- name: Install uv
|
|
run: |
|
|
pip install uv
|
|
|
|
- uses: extractions/setup-just@v3
|
|
|
|
- name: Create virtual env
|
|
run: |
|
|
uv venv
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv pip install -e ".[dev]"
|
|
|
|
- name: Run tests (Postgres Integration)
|
|
run: |
|
|
just test-int-postgres
|
|
|
|
test-semantic:
|
|
name: Test Semantic (Python 3.12)
|
|
timeout-minutes: 45
|
|
needs: [static-checks]
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.12"
|
|
cache: "pip"
|
|
|
|
- name: Install uv
|
|
run: |
|
|
pip install uv
|
|
|
|
- uses: extractions/setup-just@v3
|
|
|
|
- name: Create virtual env
|
|
run: |
|
|
uv venv
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv pip install -e ".[dev,semantic]"
|
|
|
|
- name: Run tests (Semantic)
|
|
run: |
|
|
just test-semantic
|
|
|
|
coverage:
|
|
name: Coverage Summary (combined, Python 3.12)
|
|
timeout-minutes: 60
|
|
needs:
|
|
- static-checks
|
|
- test-sqlite-unit
|
|
- test-sqlite-integration
|
|
- test-postgres-unit
|
|
- test-postgres-integration
|
|
- test-semantic
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.12"
|
|
cache: "pip"
|
|
|
|
- name: Install uv
|
|
run: |
|
|
pip install uv
|
|
|
|
- uses: extractions/setup-just@v3
|
|
|
|
- name: Create virtual env
|
|
run: |
|
|
uv venv
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv pip install -e ".[dev,semantic]"
|
|
|
|
- name: Run combined coverage (SQLite + Postgres)
|
|
run: |
|
|
just coverage
|
|
|
|
- name: Add coverage report to job summary
|
|
if: always()
|
|
run: |
|
|
{
|
|
echo "## Coverage"
|
|
echo ""
|
|
echo '```'
|
|
uv run coverage report -m
|
|
echo '```'
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Upload HTML coverage report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: htmlcov
|
|
path: htmlcov/
|