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

49 lines
1.3 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.11-bullseye
stage: check
script:
- apt-get update
- apt-get install -y make libolm-dev python3-poetry
- poetry config virtualenvs.create false
- poetry install
- make check
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
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