61 lines
2.3 KiB
YAML
61 lines
2.3 KiB
YAML
name: LottoSight CI
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
ci:
|
|
name: Syntax Check & Tests
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# ── 1. Checkout code ───────────────────────────────────────────────
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
# ── 2. Set up Python ───────────────────────────────────────────────
|
|
- name: Set up Python 3.11
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
# ── 3. Cache pip dependencies ──────────────────────────────────────
|
|
- name: Cache pip
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
|
|
# ── 4. Install system dependencies (Tk for UI tests) ─────────────
|
|
- name: Install system dependencies
|
|
run: sudo apt-get install -y python3-tk
|
|
|
|
# ── 5. Install Python dependencies ────────────────────────────────
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
pip install pytest pytest-cov
|
|
|
|
# ── 6. Syntax check — compile all .py files ────────────────────────
|
|
- name: Syntax check (py_compile)
|
|
run: |
|
|
echo "Running syntax check on all .py files..."
|
|
find . -name "*.py" \
|
|
-not -path "./.git/*" \
|
|
-not -path "./exports/*" \
|
|
| sort \
|
|
| xargs python -m py_compile
|
|
echo "Syntax check passed."
|
|
|
|
# ── 7. Run pytest ──────────────────────────────────────────────────
|
|
- name: Run tests (pytest)
|
|
run: |
|
|
pytest tests/ \
|
|
--tb=short \
|
|
--cov=db \
|
|
--cov=core \
|
|
--cov-report=term-missing \
|
|
-v
|