Skip to content

Commit 6c32d6d

Browse files
author
Gonzalo Diaz
committed
[CONFIG] [REFACTOR] [Github Actions] codecov and sonarcloud now runs in parallel.
1 parent bf75794 commit 6c32d6d

File tree

3 files changed

+51
-10
lines changed

3 files changed

+51
-10
lines changed

.github/workflows/python-coverage.yml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,61 @@ 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
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
60+
with:
61+
name: coverage-report
62+
path: coverage
63+
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
5581
uses: codecov/codecov-action@v5
5682
with:
57-
token: ${{ secrets.CODECOV_TOKEN }} # required
58-
verbose: true # optional (default = false)
83+
token: ${{ secrets.CODECOV_TOKEN }}
84+
verbose: true
5985

60-
- name: Coverage XML
61-
run: |
62-
python3 -m coverage xml
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
103+
- name: SonarQube Scan
65104
uses: SonarSource/sonarqube-scan-action@master
66105
env:
67106
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
68-
# Needed to get PR information, if any
69107
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)