-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
53 lines (46 loc) · 1.4 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
STAGE_ID: ${CI_PROJECT_NAME}_${CI_BUILD_REF_NAME}_${CI_JOB_NAME}_${CI_JOB_ID}
cache:
paths:
- .cache/pip
- venv/
stages:
- test
- package
- test-package
# Using kaniko, which is an laternative for Docker, because our Gitlab runners are not configured to build and push images with Docker.
image-creation:
stage: package
image:
name: gcr.io/kaniko-project/executor:v1.9.0-debug
entrypoint: [""]
before_script: []
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
pytest:
stage: test
image: python:3.10
script:
- python --version
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install --upgrade pip
- pip install --upgrade setuptools
- pip install -r requirements.txt
- pytest
package-creation:
stage: package
image: python:3.10
script:
- pip install build twine
- python setup.py bdist_wheel
# attention: le package registry n'autorise pas de pousser 2x la même version (==> changer ou supprimer le package)
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
artifacts:
paths:
- dist/*.whl