Skip to content

Commit 3176bc0

Browse files
authored
Merge pull request #752 from sir-gon/feature/split_coverage
[CONFIG] [REFACTOR] [Github Actions] codecov and sonarcloud now runs …
2 parents bf75794 + 8440d30 commit 3176bc0

File tree

3 files changed

+54
-12
lines changed

3 files changed

+54
-12
lines changed

.github/workflows/python-coverage.yml

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,62 @@ jobs:
4747
run: |
4848
python3 -m coverage report
4949
50-
- name: Coverage lcov
50+
- name: Coverage lcov (codecov)
5151
run: |
5252
python3 -m coverage lcov -o coverage/lcov.info
5353
54-
- name: Upload coverage reports to Codecov with GitHub Action
55-
uses: codecov/codecov-action@v5
54+
- name: Coverage xml (sonarcloud)
55+
run: |
56+
python3 -m coverage xml -o coverage/coverage.xml
57+
58+
- name: Upload coverage artifact
59+
uses: actions/upload-artifact@v4
5660
with:
57-
token: ${{ secrets.CODECOV_TOKEN }} # required
58-
verbose: true # optional (default = false)
61+
name: coverage-report
62+
path: coverage
5963

60-
- name: Coverage XML
61-
run: |
62-
python3 -m coverage xml
64+
codecov:
65+
name: Upload to Codecov
66+
runs-on: ubuntu-24.04
67+
needs: coverage
68+
69+
steps:
70+
- name: Checkout repository
71+
uses: actions/checkout@v5
72+
with:
73+
fetch-depth: 0
74+
- name: Download coverage artifact
75+
uses: actions/download-artifact@v5
76+
with:
77+
name: coverage-report
78+
path: coverage
79+
80+
- name: Upload coverage reports to Codecov
81+
uses: codecov/codecov-action@3cb13a12348ef4ffcf9783ac0f74954f92113e33
82+
with:
83+
token: ${{ secrets.CODECOV_TOKEN }}
84+
verbose: true
85+
86+
sonarqube:
87+
name: Analyze with SonarQube
88+
runs-on: ubuntu-24.04
89+
needs: coverage
90+
91+
steps:
92+
- name: Checkout repository
93+
uses: actions/checkout@v5
94+
with:
95+
fetch-depth: 0
96+
97+
- name: Download coverage artifact
98+
uses: actions/download-artifact@v5
99+
with:
100+
name: coverage-report
101+
path: coverage
63102

64-
- name: Analyze with SonarQube / SonarCloud
65-
uses: SonarSource/sonarqube-scan-action@master
103+
- name: SonarQube Scan
104+
# yamllint disable-line rule:line-length
105+
uses: SonarSource/sonarqube-scan-action@8c71dc039c2dd71d3821e89a2b58ecc7fee6ced9
66106
env:
67107
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
68-
# Needed to get PR information, if any
69108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ test: env dependencies
139139
coverage: test
140140
${RUNTIME_TOOL} -m coverage lcov -o coverage/lcov.info
141141

142+
coverage/xml: test
143+
${RUNTIME_TOOL} -m coverage xml -o coverage/coverage.xml
144+
142145
coverage/html: test
143146
${RUNTIME_TOOL} -m coverage html
144147
open htmlcov/index.html

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ sonar.exclusions=**/*test.py,**/__init__.py
1616
sonar.python.version=3.12
1717

1818
# Coverage
19-
sonar.python.coverage.reportPaths=coverage.xml
19+
sonar.python.coverage.reportPaths=coverage/coverage.xml
2020

2121
# Ignore
2222
sonar.issue.ignore.multicriteria=e1

0 commit comments

Comments
 (0)