-
Notifications
You must be signed in to change notification settings - Fork 42
177 lines (151 loc) · 5.4 KB
/
ci.yml
File metadata and controls
177 lines (151 loc) · 5.4 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CI (Tests & Quality)
on:
pull_request:
push:
branches: [main, master]
workflow_dispatch:
jobs:
# Combined blocking tests and linting in one job to reduce CI runtime
blocking-checks:
name: Blocking Tests & Quality Checks
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13']
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
# Run code quality checks (only on one Python version to save time)
- name: Code Quality Checks
if: matrix.python-version == '3.13'
run: |
black --check .
isort --check .
ruff check .
# Run critical tests
- name: Run Critical Tests
run: |
pytest tests/e2e/test_critical_paths.py tests/unit/cli/test_main.py tests/unit/test_models.py \
-v --no-cov --tb=short
timeout-minutes: 5
# Non-blocking comprehensive tests
comprehensive-tests:
name: Full Test Suite (Non-blocking)
runs-on: ubuntu-latest
continue-on-error: true # Don't fail CI
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run all tests with coverage
run: |
pytest tests/unit/ --cov=src --cov-report=xml --cov-report=html --cov-report=term
continue-on-error: true
timeout-minutes: 20
- name: Upload coverage
if: always()
uses: actions/upload-artifact@v5
with:
name: coverage-report
path: htmlcov/
retention-days: 30
# Platform testing (simplified to single job)
platform-test:
name: macOS Compatibility
runs-on: macos-latest
continue-on-error: true
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install and test
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pytest tests/e2e/test_critical_paths.py tests/unit/cli/test_main.py \
-v --no-cov --tb=short || echo "Tests failed but continuing"
timeout-minutes: 10
# Coverage data collection (PR only) - saves artifact for coverage-comment workflow
coverage-report:
name: Coverage Report
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout PR branch
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests with coverage
run: |
pytest tests/unit/ --cov=src/agentready --cov-report=xml --cov-report=term
continue-on-error: true
- name: Get coverage percentage
id: coverage
run: |
COVERAGE=$(python -c "import xml.etree.ElementTree as ET; tree = ET.parse('coverage.xml'); root = tree.getroot(); print(root.attrib['line-rate'])")
COVERAGE_PCT=$(python -c "print(f'{float(\"$COVERAGE\") * 100:.1f}')")
echo "coverage_pct=$COVERAGE_PCT" >> "$GITHUB_OUTPUT"
- name: Checkout main branch for comparison
run: |
git fetch origin main
git checkout origin/main
- name: Run tests on main branch
run: |
pytest tests/unit/ --cov=src/agentready --cov-report=xml --cov-report=term
continue-on-error: true
- name: Get main branch coverage
id: main_coverage
run: |
MAIN_COVERAGE=$(python -c "import xml.etree.ElementTree as ET; tree = ET.parse('coverage.xml'); root = tree.getroot(); print(root.attrib['line-rate'])")
MAIN_COVERAGE_PCT=$(python -c "print(f'{float(\"$MAIN_COVERAGE\") * 100:.1f}')")
echo "main_coverage_pct=$MAIN_COVERAGE_PCT" >> "$GITHUB_OUTPUT"
- name: Calculate diff
id: diff
env:
PR_COVERAGE: ${{ steps.coverage.outputs.coverage_pct }}
MAIN_COVERAGE: ${{ steps.main_coverage.outputs.main_coverage_pct }}
run: |
DIFF=$(python -c "print(f'{float(\"$PR_COVERAGE\") - float(\"$MAIN_COVERAGE\"):.1f}')")
echo "diff=$DIFF" >> "$GITHUB_OUTPUT"
- name: Save coverage data for comment workflow
env:
PR_COVERAGE: ${{ steps.coverage.outputs.coverage_pct }}
MAIN_COVERAGE: ${{ steps.main_coverage.outputs.main_coverage_pct }}
DIFF: ${{ steps.diff.outputs.diff }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
mkdir -p coverage-data
cat > coverage-data/coverage.json << EOF
{
"pr_coverage": "$PR_COVERAGE",
"main_coverage": "$MAIN_COVERAGE",
"diff": "$DIFF",
"pr_number": "$PR_NUMBER"
}
EOF
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data
path: coverage-data/
retention-days: 1