|
71 | 71 |
|
72 | 72 | - name: Run Linters and Formatters Check |
73 | 73 | run: | |
74 | | - flake8 src tests |
| 74 | + ruff check src tests |
75 | 75 | black --check src tests |
76 | 76 |
|
77 | 77 | - name: Run Type Checker (Mypy) |
@@ -116,17 +116,33 @@ jobs: |
116 | 116 |
|
117 | 117 | - name: Run Tests with Coverage |
118 | 118 | run: | |
119 | | - pytest -v --cov=src/treemapper --cov-report=xml |
| 119 | + pytest -v --cov=src/treemapper --cov-report=xml --cov-report=term-missing --cov-branch --junitxml=test-results.xml |
| 120 | +
|
| 121 | + - name: Coverage report with threshold |
| 122 | + if: runner.os == 'Linux' && matrix.python-version == '3.12' |
| 123 | + run: | |
| 124 | + coverage report --fail-under=80 --skip-covered --show-missing |
120 | 125 |
|
121 | 126 | - name: Upload coverage reports to Codecov |
122 | | - if: runner.os == 'Linux' && matrix.python-version == '3.11' |
| 127 | + if: runner.os == 'Linux' && matrix.python-version == '3.12' |
123 | 128 | uses: codecov/codecov-action@v5 |
124 | 129 | with: |
125 | 130 | token: ${{ secrets.CODECOV_TOKEN }} |
126 | 131 | files: ./coverage.xml |
| 132 | + flags: integration |
127 | 133 | fail_ci_if_error: false |
128 | 134 | verbose: true |
129 | 135 |
|
| 136 | + - name: Upload coverage for SonarCloud |
| 137 | + uses: actions/upload-artifact@v5 |
| 138 | + if: runner.os == 'Linux' && matrix.python-version == '3.12' |
| 139 | + with: |
| 140 | + name: coverage-report |
| 141 | + path: | |
| 142 | + coverage.xml |
| 143 | + test-results.xml |
| 144 | + retention-days: 1 |
| 145 | + |
130 | 146 | # ============================================================================ |
131 | 147 | # PyPy Compatibility Testing |
132 | 148 | # ============================================================================ |
@@ -164,72 +180,6 @@ jobs: |
164 | 180 | run: | |
165 | 181 | pytest -v |
166 | 182 |
|
167 | | - # ============================================================================ |
168 | | - # Test Coverage with Quality Gates |
169 | | - # Evidence: Branch coverage correlates with defect detection |
170 | | - # ============================================================================ |
171 | | - test-coverage: |
172 | | - name: Test Coverage & Quality Gates |
173 | | - runs-on: ubuntu-latest |
174 | | - strategy: |
175 | | - matrix: |
176 | | - python-version: ['3.10', '3.11', '3.12'] |
177 | | - |
178 | | - steps: |
179 | | - - uses: actions/checkout@v6 |
180 | | - |
181 | | - - name: Set up Python ${{ matrix.python-version }} |
182 | | - uses: actions/setup-python@v6 |
183 | | - with: |
184 | | - python-version: ${{ matrix.python-version }} |
185 | | - |
186 | | - - name: Cache dependencies |
187 | | - uses: actions/cache@v4 |
188 | | - with: |
189 | | - path: ~/.cache/pip |
190 | | - key: ${{ runner.os }}-pip-cov-${{ hashFiles('**/pyproject.toml') }} |
191 | | - restore-keys: | |
192 | | - ${{ runner.os }}-pip-cov- |
193 | | -
|
194 | | - - name: Install dependencies |
195 | | - run: | |
196 | | - python -m pip install --upgrade pip |
197 | | - pip install -e .[dev] |
198 | | -
|
199 | | - - name: Run tests with branch coverage |
200 | | - run: | |
201 | | - pytest \ |
202 | | - --cov=src/treemapper \ |
203 | | - --cov-report=xml \ |
204 | | - --cov-report=term-missing \ |
205 | | - --cov-branch \ |
206 | | - --junitxml=test-results.xml \ |
207 | | - -v |
208 | | -
|
209 | | - - name: Coverage report with threshold |
210 | | - run: | |
211 | | - coverage report --fail-under=80 --skip-covered --show-missing |
212 | | -
|
213 | | - - name: Upload coverage to Codecov |
214 | | - uses: codecov/codecov-action@v5 |
215 | | - with: |
216 | | - token: ${{ secrets.CODECOV_TOKEN }} |
217 | | - files: ./coverage.xml |
218 | | - flags: unittests |
219 | | - name: codecov-${{ matrix.python-version }} |
220 | | - fail_ci_if_error: false |
221 | | - verbose: true |
222 | | - |
223 | | - - name: Upload coverage for SonarCloud |
224 | | - uses: actions/upload-artifact@v5 |
225 | | - if: matrix.python-version == '3.12' |
226 | | - with: |
227 | | - name: coverage-report |
228 | | - path: | |
229 | | - coverage.xml |
230 | | - test-results.xml |
231 | | - retention-days: 1 |
232 | | - |
233 | 183 | # ============================================================================ |
234 | 184 | # Mutation Testing (test effectiveness validation) |
235 | 185 | # Evidence: Mutation score correlates with real fault detection |
@@ -353,7 +303,7 @@ jobs: |
353 | 303 | sonarcloud: |
354 | 304 | name: SonarCloud Analysis |
355 | 305 | runs-on: ubuntu-latest |
356 | | - needs: test-coverage |
| 306 | + needs: test |
357 | 307 | if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' |
358 | 308 |
|
359 | 309 | steps: |
@@ -384,7 +334,6 @@ jobs: |
384 | 334 | sonar.python.coverage.reportPaths=coverage.xml |
385 | 335 | sonar.python.xunit.reportPath=test-results.xml |
386 | 336 | sonar.python.version=3.9,3.10,3.11,3.12 |
387 | | - sonar.exclusions=**/*_test.py,**/test_*.py |
388 | 337 | EOF |
389 | 338 |
|
390 | 339 | - name: SonarCloud Scan |
|
0 commit comments