mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
3050fe8318
The just.systems install script intermittently returns HTTP 403, causing CI jobs to fail before tests even run. The extractions/setup-just GitHub Action downloads from GitHub releases instead, which is reliable. Also removes the separate Windows choco install step since the action handles all platforms natively. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
154 lines
3.6 KiB
YAML
154 lines
3.6 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
# pull_request_target runs on the BASE of the PR, not the merge result.
|
|
# It has write permissions and access to secrets.
|
|
# It's useful for PRs from forks or automated PRs but requires careful use for security reasons.
|
|
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
|
|
pull_request_target:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
test-sqlite:
|
|
name: Test SQLite (${{ matrix.os }}, Python ${{ matrix.python-version }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]
|
|
python-version: [ "3.12", "3.13", "3.14" ]
|
|
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,semantic]"
|
|
|
|
- name: Run type checks
|
|
run: |
|
|
just typecheck
|
|
|
|
- name: Run linting
|
|
run: |
|
|
just lint
|
|
|
|
- name: Run tests (SQLite)
|
|
run: |
|
|
uv pip install pytest pytest-cov
|
|
just test-sqlite
|
|
|
|
test-postgres:
|
|
name: Test Postgres (Python ${{ matrix.python-version }})
|
|
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,semantic]"
|
|
|
|
- name: Run tests (Postgres via testcontainers)
|
|
run: |
|
|
uv pip install pytest pytest-cov
|
|
just test-postgres
|
|
|
|
coverage:
|
|
name: Coverage Summary (combined, Python 3.12)
|
|
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: |
|
|
uv pip install pytest pytest-cov
|
|
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/
|