tests.yml•2.98 kB
name: tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Create virtual environment
run: uv venv --python ${{ matrix.python-version }}
- name: Install dependencies
run: uv pip install -e ".[dev]"
- name: Run tests with pytest
run: uv run pytest --cov=mnemex --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
with:
files: ./coverage.xml
flags: unittests
name: codecov-ubuntu-py310
fail_ci_if_error: false
verbose: true
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.10
- name: Create virtual environment
run: uv venv --python 3.10
- name: Install dependencies
run: uv pip install -e ".[dev]"
- name: Run ruff check
run: uv run ruff check src/mnemex tests
- name: Run ruff format check
run: uv run ruff format --check src/mnemex tests
- name: Run mypy
run: uv run mypy src/mnemex
validate:
name: Validate Configs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Validate pyproject.toml parses
run: |
python -m pip install --upgrade pip tomli
python - << 'PY'
import sys, pathlib
import tomli
p = pathlib.Path('pyproject.toml')
with p.open('rb') as f:
tomli.load(f)
print('✓ pyproject.toml parses OK')
PY
fs-sanity:
name: Filesystem Sanity Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Detect duplicate filenames with trailing numbers
run: |
set -euo pipefail
dupes=$(git ls-files | grep -E ' [0-9]+(\.|$)' || true)
if [ -n "$dupes" ]; then
echo "Found suspicious duplicate files:" >&2
echo "$dupes" >&2
exit 1
fi
echo "✓ No suspicious duplicate files found"
gate:
name: Gate
runs-on: ubuntu-latest
needs: [test, lint, validate, fs-sanity]
steps:
- name: All checks passed
run: echo "✓ All checks passed"