-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
94 lines (85 loc) · 2.06 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
variables:
DOCKER_TAG: "${CI_COMMIT_SHA}"
PIPENV_VENV_IN_PROJECT: "true"
stages:
- build
- test
- package
- ship
- run-downstreams
image: python:3.8
whl:
stage: build
before_script:
- pip install pipenv
- pipenv lock -r > requirements.txt
script:
- python setup.py sdist bdist_wheel
artifacts:
paths:
- dist/*
pytest:
stage: test
before_script:
- pip install pipenv
- pipenv install --dev
script:
- pipenv run pre-commit run --all-files
- pipenv run pytest
cache:
paths:
- .venv/*
except:
- tags
.dockerize:
stage: package
services:
- docker:19.03.13-dind
image: docker:19.03.13
dockerize:
extends:
.dockerize
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE:$DOCKER_TAG" .
- docker push "$CI_REGISTRY_IMAGE:$DOCKER_TAG"
only:
- branches
docker-sign:
extends:
.dockerize
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull "$CI_REGISTRY_IMAGE:$DOCKER_TAG"
- docker tag "$CI_REGISTRY_IMAGE:$DOCKER_TAG" "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG#v}"
- docker push "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG#v}"
- docker tag "$CI_REGISTRY_IMAGE:$DOCKER_TAG" "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:latest"
only:
- tags
pypi:
stage: ship
before_script:
- pip install pipenv twine
- pipenv lock -r > requirements.txt
script:
- python setup.py verify
- TWINE_USERNAME="gitlab-ci-token" TWINE_PASSWORD="${CI_JOB_TOKEN}"
python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
needs:
- whl
rules:
- if: "$CI_COMMIT_TAG"
release-jupyterlab-streaming:
stage: run-downstreams
inherit:
variables: false
variables:
STREAMING_CLI_VERSION: "${CI_COMMIT_TAG}"
trigger:
project: 'getindata/streaming-labs/docker-images/jupyterlab-streaming'
branch: 'main'
needs:
- pypi
rules:
- if: "$CI_COMMIT_TAG"