[CONFIG] [REFACTOR] [Github Actions] codecov and sonarcloud now runs … #900
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Python CI Coverage | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: ["main"] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: ["main"] | |
workflow_dispatch: | |
env: | |
LOG_LEVEL: INFO | |
jobs: | |
coverage: | |
name: "Python CI Coverage" | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-24.04"] | |
python: ["3.12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
with: | |
# Shallow clones should be disabled for a better relevancy of analysis | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@master | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install | |
run: | | |
pip3 install -r requirements.txt | |
- name: Test an coverage collect | |
run: > | |
python3 -m coverage run -m pytest --verbose | |
-o log_cli=true | |
--log-cli-level=INFO | |
src/ | |
- name: Coverage Report | |
run: | | |
python3 -m coverage report | |
- name: Coverage lcov (codecov) | |
run: | | |
python3 -m coverage lcov -o coverage/lcov.info | |
- name: Coverage xml (sonarcloud) | |
run: | | |
python3 -m coverage xml -o coverage/coverage.xml | |
- name: Upload coverage artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage | |
codecov: | |
name: Upload to Codecov | |
runs-on: ubuntu-24.04 | |
needs: coverage | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Download coverage artifact | |
uses: actions/download-artifact@v5 | |
with: | |
name: coverage-report | |
path: coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
sonarqube: | |
name: Analyze with SonarQube | |
runs-on: ubuntu-24.04 | |
needs: coverage | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Download coverage artifact | |
uses: actions/download-artifact@v5 | |
with: | |
name: coverage-report | |
path: coverage | |
- name: SonarQube Scan | |
uses: SonarSource/sonarqube-scan-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |