diff options
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..795dbfb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,45 @@ +stages: + - test + - build + +docker-build-master: + image: docker:latest + stage: build + services: + - docker:dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" . + - docker push "$CI_REGISTRY_IMAGE" + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" + only: + - master + +docker-build: + image: docker:latest + stage: build + services: + - docker:dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" . + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" + except: + - master + + +test: + image: python:3-alpine + stage: test + script: + - pip install -r dev-requirements.txt + - pytest -n 4 --junitxml=report.xml + - coverage run -m pytest + - coverage xml -o cobertura.xml + artifacts: + reports: + cobertura: cobertura.xml + junit: report.xml |