Forked from
ICS Control System Infrastructure / csentry
267 commits behind the upstream repository.
-
Benjamin Bertrand authored
New feature added in GitLab 11.2. See https://docs.gitlab.com/ee/ci/yaml/README.html#artifacts-reports-junit
Benjamin Bertrand authoredNew feature added in GitLab 11.2. See https://docs.gitlab.com/ee/ci/yaml/README.html#artifacts-reports-junit
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 3.05 KiB
image: docker:latest
.runner_tags: &runner_tags
tags:
- docker
variables:
CONTAINER_TEST_IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
CONTAINER_RELEASE_IMAGE: "$CI_REGISTRY_IMAGE:latest"
CONTAINER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE:master"
POSTGRES_USER: ics
POSTGRES_PASSWORD: icspwd
POSTGRES_DB: csentry_db_test
stages:
- check
- build
- test
- analyse
- release
- deploy
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
check:
<<: *runner_tags
stage: check
image: registry.esss.lu.se/ics-docker/pre-commit:latest
before_script: []
script:
- pre-commit run --all-files
build:
<<: *runner_tags
stage: build
script:
- docker pull "$CONTAINER_CACHE_IMAGE" || true
- docker build --pull --cache-from "$CONTAINER_CACHE_IMAGE" -t "$CONTAINER_TEST_IMAGE" .
- docker push "$CONTAINER_TEST_IMAGE"
test:
<<: *runner_tags
stage: test
image: "$CONTAINER_TEST_IMAGE"
services:
- postgres:10
- redis:4.0
before_script:
- pip install -r requirements-dev.txt
script:
- pytest --junitxml=junit.xml --cov-report xml:coverage.xml --cov=app -v
artifacts:
paths:
- junit.xml
- coverage.xml
reports:
junit: junit.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