matrix-ops-bot/.gitlab-ci.yml

51 lines
1.4 KiB
YAML

---
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
# speed up build time by pulling the old image
- docker pull registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:main
- 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
# speed up build time by pulling the old image
- docker pull registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:main
- docker build --no-cache -t $UNIQUE_IMAGE .
- docker push $UNIQUE_IMAGE
- docker tag $UNIQUE_IMAGE $REF_IMAGE
- docker push $REF_IMAGE
only:
- main
- tags