-
Notifications
You must be signed in to change notification settings - Fork 4
39 lines (36 loc) · 1.11 KB
/
sonarcloud.yml
File metadata and controls
39 lines (36 loc) · 1.11 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
name: sonarcloud
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
# it should be in editable mode for coverage to work
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Run unit tests and store coverage
run: |
# [!] Note that sonarcloud runs the fast test suite
pytest --fast -n auto --cov=src --cov-report=xml:coverage.xml --cov-report=term-missing
- name: Make coverage paths relative
run: sed -i "s+$PWD/++g" coverage.xml
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}