forked from costrouc/pysrim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
77 lines (70 loc) · 2.35 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
variables:
TWINE_USERNAME: SECURE
TWINE_PASSWORD: SECURE
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
ANACONDA_USERNAME: SECURE
ANACONDA_TOKEN: SECURE
DOCKER_PASSWORD: SECURE
DOCKER_USERNAME: SECURE
stages:
- test
- deploy
test:
image: python:3
stage: test
script:
- pip install .
- python setup.py test --addopts "--cov=srim"
deploy_pypi:
image: python:3
stage: deploy
script:
- pip install -U twine setuptools
- python setup.py sdist bdist_wheel
- twine upload dist/*.tar.gz
- twine upload dist/*.whl
only:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
deploy_conda:
image: continuumio/miniconda3:latest
stage: deploy
script:
- conda install conda-build anaconda-client -y
- conda build --user $ANACONDA_USERNAME --token $ANACONDA_TOKEN .conda/pysrim
only:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
deploy_docker_pysrim:
image: docker:git
stage: deploy
services:
- docker:dind
script:
- export DOCKER_IMAGE="costrouc/pysrim"
- export GITLAB_IMAGE="$CI_REGISTRY/$CI_PROJECT_PATH"
- export PKG_VERSION=$CI_COMMIT_TAG
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $DOCKER_IMAGE:$PKG_VERSION -f Dockerfile.pysrim --build-arg VERSION=$PKG_VERSION .
- docker tag $DOCKER_IMAGE:$PKG_VERSION $DOCKER_IMAGE:latest
- docker tag $DOCKER_IMAGE:$PKG_VERSION $GITLAB_IMAGE:$PKG_VERSION
- docker tag $DOCKER_IMAGE:$PKG_VERSION $GITLAB_IMAGE:latest
- docker push $DOCKER_IMAGE:$PKG_VERSION
- docker push $DOCKER_IMAGE:latest
- docker push $GITLAB_IMAGE:$PKG_VERSION
- docker push $GITLAB_IMAGE:latest
only:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
deploy_docker_srim:
image: docker:git
services:
- docker:dind
script:
- export DOCKER_IMAGE="costrouc/srim"
- export PKG_VERSION=${CI_COMMIT_TAG:5}
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker build -t $DOCKER_IMAGE:$PKG_VERSION -f Dockerfile.srim .
- docker tag $DOCKER_IMAGE:$PKG_VERSION $DOCKER_IMAGE:latest
- docker push $DOCKER_IMAGE:$PKG_VERSION
- docker push $DOCKER_IMAGE:latest
only:
- /^srim-v\d+\.\d+\.\d+([abc]\d*)?$/ # trigger to build srim dockerfile