diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f5365c6 --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/Makefile b/Makefile index 9639c06..db944ac 100644 --- a/Makefile +++ b/Makefile @@ -11,4 +11,8 @@ types: $(POETRY) mypy $(SRC) test: - $(POETRY) pytest $(TESTS) \ No newline at end of file + $(POETRY) pytest $(TESTS) + + + +ci: lint types test \ No newline at end of file