104 lines
3.0 KiB
YAML
104 lines
3.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, dev]
|
|
pull_request:
|
|
branches: [main, dev]
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
- run: pip install ruff
|
|
- run: ruff check src/ tests/
|
|
- run: ruff format --check src/ tests/
|
|
|
|
test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
- run: coverage run -m pytest -v --tb=short --rootdir=.
|
|
|
|
standards:
|
|
name: seedgo-audit
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
- run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
- name: Run seedgo standards audit
|
|
run: python -c "
|
|
import sys
|
|
from pathlib import Path
|
|
from aipass.seedgo.apps.handlers.audit.branch_audit import audit_branch
|
|
from aipass.seedgo.apps.handlers.bypass.bypass_handler import load_bypass_rules
|
|
|
|
src = Path('src/aipass')
|
|
pack = src / 'seedgo/apps/handlers/aipass_standards'
|
|
|
|
branches = []
|
|
for d in sorted(src.iterdir()):
|
|
if d.is_dir() and (d / 'apps').is_dir():
|
|
entry = d / 'apps' / f'{d.name}.py'
|
|
branches.append({'name': d.name, 'path': str(d),
|
|
'entry_file': str(entry) if entry.exists() else ''})
|
|
|
|
failed = []
|
|
for branch in branches:
|
|
bypass_rules = load_bypass_rules(branch['path'])
|
|
result = audit_branch(branch, bypass_rules, pack_path=pack)
|
|
avg = result.get('average', 0)
|
|
print(f\" {branch['name']:>12}: {avg:.0f}%\")
|
|
if avg < 80:
|
|
failed.append((branch['name'], avg))
|
|
|
|
if failed:
|
|
print(f\"\nFAILED: {len(failed)} branch(es) below 80%\")
|
|
for name, score in failed:
|
|
print(f\" {name}: {score:.0f}%\")
|
|
sys.exit(1)
|
|
else:
|
|
print(f\"\nAll {len(branches)} branches pass (>=80%)\")
|
|
"
|
|
|
|
coverage:
|
|
name: coverage
|
|
needs: [test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
- run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
- run: coverage run -m pytest --rootdir=.
|
|
- run: coverage xml
|
|
- uses: codecov/codecov-action@v6
|
|
with:
|
|
files: ./coverage.xml
|
|
fail_ci_if_error: false
|