-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from wednesday-solutions/feat/sonar_integration
Feat:Sonar Integration
- Loading branch information
Showing
4 changed files
with
52 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,50 @@ | ||
name: FastAPI-CI | ||
|
||
on: | ||
'on': | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Install plugin | ||
run: pip install pytest-github-actions-annotate-failures | ||
|
||
- name: Build coverage file | ||
run: | | ||
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=app app/tests/ | tee pytest-coverage.txt | ||
- name: Pytest coverage comment | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
pytest-coverage-path: ./pytest-coverage.txt | ||
junitxml-path: ./pytest.xml | ||
|
||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Install plugin | ||
run: pip install pytest-github-actions-annotate-failures | ||
- name: Build coverage file | ||
run: > | ||
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered | ||
--cov=app app/tests/ | tee pytest-coverage.txt | ||
- name: Pytest coverage comment | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
pytest-coverage-path: ./pytest-coverage.txt | ||
junitxml-path: ./pytest.xml | ||
- name: SonarQube Scan | ||
uses: sonarsource/sonarqube-scan-action@master | ||
with: | ||
args: | | ||
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}' | ||
SONAR_HOST_URL: '${{ secrets.SONAR_HOST_URL }}' | ||
- uses: sonarsource/sonarqube-quality-gate-action@master | ||
timeout-minutes: 5 | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}' | ||
SONAR_HOST_URL: '${{ secrets.SONAR_HOST_URL }}' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ venv | |
tmp/ | ||
temp/ | ||
*.xml | ||
.idea |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
coverage run -m pytest | ||
coverage report | ||
coverage report |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
sonar.projectKey=wednesday-solutions_python-fastapi_AY434cJSB2n8RRmGoUoD | ||
sonar.projectName=python-fastapi | ||
sonar.projectVersion=1.0 | ||
sonar.sources=./app | ||
sonar.test.inclusions=**/test_*.py | ||
sonar.tests=./app | ||
sonar.language=py | ||
sonar.sourceEncoding=UTF-8 | ||
sonar.coverage.exclusions=**/*.* | ||
sonar.python.tests.reportPaths=test-report.json | ||
sonar.python.coverage.reportPaths=coverage.xml |
6b768ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report