Skip to content
Snippets Groups Projects
Commit 15d5e2a6 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Add code analysis stage using sonar-scanner

Create unit test and coverage report with pytest
parent 737f9f58
No related branches found
No related tags found
No related merge requests found
......@@ -7,3 +7,6 @@ settings*.cfg
.cache
.coverage
/docs/_build
.scannerwork
coverage.xml
junit.xml
......@@ -15,6 +15,7 @@ variables:
stages:
- build
- test
- analyse
- release
- deploy
......@@ -38,7 +39,20 @@ test:
- redis:4.0
before_script: []
script:
- pytest --cov=app -v
- pytest --junitxml=junit.xml --cov-report xml:coverage.xml --cov=app -v
artifacts:
paths:
- junit.xml
- coverage.xml
expire_in: 1 hour
analyse:
<<: *runner_tags
stage: analyse
image: registry.esss.lu.se/ics-docker/sonar-scanner:3
before_script: []
script:
- sonar-scanner -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.projectVersion=$CI_COMMIT_REF_NAME
release-image:
<<: *runner_tags
......
# must be unique in a given SonarQube instance
sonar.projectKey=csentry
# this is the name displayed in the SonarQube UI.
sonar.projectName=CSEntry
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=app
sonar.python.xunit.reportPath=junit.xml
sonar.python.coverage.reportPath=coverage.xml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment