Add ci
This commit is contained in:
parent
be8d7d6eee
commit
893982e0ad
2 changed files with 52 additions and 1 deletions
47
.gitlab-ci.yml
Normal file
47
.gitlab-ci.yml
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue