File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : SonarCloud Scan
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches :
9+ - main
10+
11+ jobs :
12+ sonarcloud :
13+ name : SonarCloud Scan
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+
20+ - name : Set up Python
21+ uses : actions/setup-python@v5
22+ with :
23+ python-version : ' 3.12'
24+
25+ - name : Install dependencies
26+ run : |
27+ python -m pip install --upgrade pip
28+ pip install -r requirements.txt
29+ pip install pytest pytest-cov
30+
31+ - name : Run tests with coverage
32+ run : |
33+ pytest --cov=./ --cov-report=xml
34+
35+ - name : SonarCloud Scan
36+ uses : sonarsource/sonarcloud-github-action@v2.2.1
37+ with :
38+ projectBaseDir : .
39+ extraProperties : |
40+ sonar.projectKey=alexjelani_python-fastapi
41+ sonar.sources=.
42+ sonar.python.coverage.reportPaths=coverage.xml
43+ sonar.tests=tests
44+ sonar.test.inclusions=tests/**/*.py
45+ sonar.sourceEncoding=UTF-8
46+ sonar.exclusions=.github/**,tests/**
47+ sonar.login=${{ secrets.SONAR_TOKEN }}
You can’t perform that action at this time.
0 commit comments