mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fb5e9e1d77
Signed-off-by: phernandez <paul@basicmachines.co> Co-authored-by: Claude <noreply@anthropic.com>
127 lines
3.3 KiB
YAML
127 lines
3.3 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" ]
|
|
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
|
|
|
|
- name: Install just (Linux/macOS)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
|
|
|
|
- name: Install just (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
# Install just using Chocolatey (pre-installed on GitHub Actions Windows runners)
|
|
choco install just --yes
|
|
shell: pwsh
|
|
|
|
- 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
|
|
|
|
- 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" ]
|
|
runs-on: ubuntu-latest
|
|
|
|
# Postgres service (only available on Linux runners)
|
|
services:
|
|
postgres:
|
|
image: postgres:17
|
|
env:
|
|
POSTGRES_DB: basic_memory_test
|
|
POSTGRES_USER: basic_memory_user
|
|
POSTGRES_PASSWORD: dev_password
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5433:5432
|
|
|
|
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
|
|
|
|
- name: Install just
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
|
|
|
|
- name: Create virtual env
|
|
run: |
|
|
uv venv
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
uv pip install -e .[dev]
|
|
|
|
- name: Run tests (Postgres)
|
|
run: |
|
|
uv pip install pytest pytest-cov
|
|
just test-postgres |