This commit is contained in:
Abel Luck 2022-07-22 12:59:55 +00:00
parent be8d7d6eee
commit 893982e0ad
2 changed files with 52 additions and 1 deletions

47
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,47 @@
---
services:
- docker:dind
stages:
- check
- build
variables:
UNIQUE_IMAGE: registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:$CI_COMMIT_SHORT_SHA
REF_IMAGE: registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:$CI_COMMIT_REF_NAME
check:
image: python:3.9-bullseye
stage: check
script:
- apt-get update
- apt-get install -y make libolm-dev
- pip install poetry
- poetry config virtualenvs.create false
- poetry install
- make ci
build-test:
image: docker:git
stage: build
script:
- echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
- docker build -t $UNIQUE_IMAGE .
- docker push $UNIQUE_IMAGE
- docker run --entrypoint /test $UNIQUE_IMAGE
except:
- main
- tags
build:
image: docker:git
stage: build
script:
- echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin registry.gitlab.com
- docker build --no-cache -t $UNIQUE_IMAGE .
- docker push $UNIQUE_IMAGE
- docker tag $UNIQUE_IMAGE $REF_IMAGE
- docker push $REF_IMAGE
only:
- main
- tags

View file

@ -12,3 +12,7 @@ types:
test:
$(POETRY) pytest $(TESTS)
ci: lint types test