soft-analytics-01/.gitlab-ci.yml

56 lines
1.2 KiB
YAML

image: python:3.10.7
stages:
- test
- sonarqube
- code_quality
- deploy
tests:
stage: test
script:
- python -m venv venv
- source venv/bin/activate
- pip install -r requirements.txt
- python -m pytest --cov=. --junitxml=coverage/junit-report.xml tests
- coverage xml
artifacts:
when: always
paths:
- coverage.xml
- coverage/
reports:
#cobertura: coverage/cobertura-coverage.xml
junit: coverage/junit-report.xml
sonarqube-check:
only:
- main #Code quality runs only on main
stage: code_quality
allow_failure: true
image:
name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/sonarsource/sonar-scanner-cli:latest
entrypoint: ['']
variables:
SONAR_USER_HOME: '${CI_PROJECT_DIR}/.sonar'
GIT_DEPTH: '0' # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: '${CI_JOB_NAME}'
paths:
- .sonar/cache
script:
- sonar-scanner
#docker-build:
# image: docker:latest
# stage: deploy
# services:
# - docker:dind
# before_script:
# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
# script:
# - docker build -t "$CI_REGISTRY_USER/sa-triage" .
# - docker push "$CI_REGISTRY_USER/sa-triage"