.gitlab-ci.yml 977 B
stages:
- test
- build
variables:
DOCKER_REGISTRY: harbor.uio.no
# Run tests on all branches
test:
stage: test
image: python:3.9
script:
- pip install gitlint
- gitlint --commits `git rev-list --max-parents=0 HEAD`..HEAD
- pip install poetry
- poetry install --no-interaction --no-ansi
- poetry run coverage run --branch --source='.' -m unittest
- poetry run coverage xml
- poetry run coverage report
artifacts:
reports:
cobertura: coverage.xml
# When new changes are pushed, this step will login to harbor, and run the
# update-harbor-image.sh script to build, tag and push a new docker image.
build:
stage: build
image: harbor.uio.no/library/docker.io-docker:dind
services:
- docker:dind
script:
- apk add --no-cache git
- git --version
- printf '%s' "$CI_HARBOR_TOKEN" | docker login -u "$CI_HARBOR_USERNAME" --password-stdin "$DOCKER_REGISTRY"
- sh ./update-harbor-image.sh
- docker logout