1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-12-22 13:08:13 +00:00
senpy/.gitlab-ci.yml

134 lines
3.7 KiB
YAML
Raw Normal View History

2017-05-19 12:38:29 +00:00
# Uncomment if you want to use docker-in-docker
# image: gsiupm/dockermake:latest
# services:
# - docker:dind
2017-02-13 11:04:29 +00:00
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
stages:
- test
2022-05-23 07:52:22 +00:00
- publish
- test_image
2022-05-23 10:45:40 +00:00
- deploy
variables:
KUBENS: senpy
2022-05-23 14:03:30 +00:00
LATEST_IMAGE: "${HUB_REPO}:${CI_COMMIT_SHORT_SHA}"
2023-09-26 15:57:36 +00:00
SENPY_DATA: "/senpy-data/" # This is configured in the CI job
2023-09-26 17:33:50 +00:00
NLTK_DATA: "/senpy-data/nltk_data" # Store NLTK downloaded data
2017-05-19 12:38:29 +00:00
2022-05-23 07:52:22 +00:00
docker:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
2022-05-23 07:52:22 +00:00
PYTHON_VERSION: "3.10"
tags:
- docker
2017-02-13 11:04:29 +00:00
script:
2022-05-23 13:19:46 +00:00
- echo $CI_COMMIT_TAG > senpy/VERSION
2022-05-23 07:52:22 +00:00
- sed "s/{{PYVERSION}}/$PYTHON_VERSION/" Dockerfile.template > Dockerfile
2022-05-23 09:20:15 +00:00
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"},\"https://index.docker.io/v1/\":{\"auth\":\"$HUB_AUTH\"}}}" > /kaniko/.docker/config.json
2022-05-23 07:52:22 +00:00
# The skip-tls-verify flag is there because our registry certificate is self signed
- /kaniko/executor --context $CI_PROJECT_DIR --skip-tls-verify --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --destination $HUB_REPO:$CI_COMMIT_TAG
2017-02-13 11:04:29 +00:00
only:
2017-02-13 18:41:18 +00:00
- tags
2017-02-13 11:04:29 +00:00
2022-05-23 10:51:47 +00:00
docker-latest:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
PYTHON_VERSION: "3.10"
tags:
- docker
script:
2022-05-23 15:03:34 +00:00
- echo git.${CI_COMMIT_SHORT_SHA} > senpy/VERSION
2022-05-23 10:51:47 +00:00
- sed "s/{{PYVERSION}}/$PYTHON_VERSION/" Dockerfile.template > Dockerfile
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"},\"https://index.docker.io/v1/\":{\"auth\":\"$HUB_AUTH\"}}}" > /kaniko/.docker/config.json
# The skip-tls-verify flag is there because our registry certificate is self signed
2022-05-23 14:03:30 +00:00
- /kaniko/executor --context $CI_PROJECT_DIR --skip-tls-verify --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $LATEST_IMAGE --destination "${HUB_REPO}:latest"
2022-05-23 10:51:47 +00:00
only:
refs:
- master
testimage:
2023-09-26 17:02:11 +00:00
only:
- tags
tags:
- docker
stage: test_image
image: "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
script:
- python -m senpy --no-run --test
2022-05-23 07:52:22 +00:00
testpy37:
tags:
- docker
variables:
SENPY_STRICT: "false"
2022-05-23 07:52:22 +00:00
image: python:3.7
stage: test
script:
- pip install -r requirements.txt -r test-requirements.txt
2022-05-23 07:52:22 +00:00
- python setup.py test
2022-05-23 07:52:22 +00:00
testpy310:
tags:
- docker
variables:
SENPY_STRICT: "true"
2022-05-23 07:52:22 +00:00
image: python:3.10
stage: test
2017-05-19 12:38:29 +00:00
script:
2023-09-26 16:10:16 +00:00
- pip install -r requirements.txt -r test-requirements.txt -r extra-requirements.txt
2022-05-23 07:52:22 +00:00
- python setup.py test
2017-05-19 12:38:29 +00:00
2022-05-23 07:52:22 +00:00
push_pypi:
only:
2022-05-23 07:52:22 +00:00
- tags
tags:
- docker
image: python:3.10
2022-05-23 07:52:22 +00:00
stage: publish
2017-05-19 15:55:52 +00:00
script:
2022-05-23 07:52:22 +00:00
- echo $CI_COMMIT_TAG > senpy/VERSION
- pip install twine
- python setup.py sdist bdist_wheel
- TWINE_PASSWORD=$PYPI_PASSWORD TWINE_USERNAME=$PYPI_USERNAME python -m twine upload dist/*
2017-05-19 15:55:52 +00:00
2022-05-23 07:52:22 +00:00
check_pypi:
2017-05-19 15:55:52 +00:00
only:
2022-05-23 07:52:22 +00:00
- tags
tags:
- docker
image: python:3.10
2022-05-23 10:45:40 +00:00
stage: deploy
script:
2022-05-23 07:52:22 +00:00
- pip install senpy==$CI_COMMIT_TAG
# Allow PYPI to update its index before we try to install
when: delayed
start_in: 10 minutes
2022-05-23 10:45:40 +00:00
2022-05-23 10:51:47 +00:00
latest-demo:
2022-05-23 10:45:40 +00:00
only:
refs:
- master
tags:
- docker
image: alpine/k8s:1.22.6
stage: deploy
environment: production
variables:
2022-05-23 11:09:29 +00:00
KUBECONFIG: "/kubeconfig"
2022-05-23 14:03:30 +00:00
# Same image as docker-latest
IMAGEWTAG: "${LATEST_IMAGE}"
2022-05-23 10:45:40 +00:00
KUBEAPP: "senpy"
script:
2022-05-23 11:09:29 +00:00
- echo "${KUBECONFIG_RAW}" > $KUBECONFIG
2023-09-26 18:25:37 +00:00
- kubectl --kubeconfig $KUBECONFIG version
2022-05-23 10:45:40 +00:00
- cd k8s/
2022-05-23 11:09:29 +00:00
- cat *.yaml *.tmpl 2>/dev/null | envsubst | kubectl --kubeconfig $KUBECONFIG apply --namespace ${KUBENS:-default} -f -
- kubectl --kubeconfig $KUBECONFIG get all,ing -l app=${KUBEAPP} --namespace=${KUBENS:-default}