-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (69 loc) · 2.61 KB
/
Copy pathci.yml
File metadata and controls
86 lines (69 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Relay CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
quality:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Check py.typed marker
run: |
if [ ! -f src/relay/py.typed ]; then
echo "Error: src/relay/py.typed is missing. Library consumers need this for type hints."
exit 1
fi
- name: Type check source (mypy --strict)
run: mypy --strict src/
- name: Type check tests (mypy --strict)
run: mypy --strict tests/
- name: Check no assert in production code
run: |
if grep -rn '^\s*assert\b' src/relay/ --include='*.py' | grep -v '__pycache__'; then
echo "Error: production assert statements found (see above). Use explicit Failure returns."
exit 1
fi
- name: Check version consistency
run: |
PV=$(grep '^version' pyproject.toml | sed 's/.*"\(.*\)".*/\1/')
TV=$(grep '^__version__' src/relay/types.py | sed 's/.*"\(.*\)".*/\1/')
if [ "$PV" != "$TV" ]; then
echo "Error: version mismatch pyproject.toml='$PV' vs types.py='$TV'"
exit 1
fi
- name: Enforce test naming convention (Rule 7.1)
run: python scripts/check_test_names.py
- name: Run test suite with coverage
run: |
coverage run -m pytest tests/ -v
coverage report --fail-under=80
- name: Enforce no # type: ignore in source
run: |
if grep -rn '# type: ignore' src/relay/ --include='*.py' | grep -v '__pycache__'; then
echo "Error: # type: ignore found in source code. Rule 2.1 forbids this."
exit 1
fi
- name: Enforce no # type: ignore in tests
run: |
if grep -rn '# type: ignore' tests/ --include='*.py' | grep -v '__pycache__'; then
echo "Warning: # type: ignore found in test code."
fi
- name: Check layer violations
run: python scripts/check_layer_violations.py
- name: Check no private API imports in tests
run: python scripts/check_no_private_api_imports.py --warn
- name: Check Failure code test coverage
run: python scripts/check_failure_coverage.py