-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
81 lines (72 loc) · 1.93 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
image: "python:3.9"
stages:
- test
- build
- deploy
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375
CI_REGISTRY_IMAGE: ebispot/gwas-sumstats-tools
.before_script_template:
before_script:
- pip install --upgrade pip
- pip install poetry
- poetry install
test:
extends: .before_script_template
stage: test
script:
- poetry run pytest -v
deploy_test:
extends: .before_script_template
stage: deploy
script:
- poetry config repositories.testpypi https://test.pypi.org/legacy/
- poetry build
- poetry publish --repository=testpypi --username=$PYPI_API_TOKEN_USERNAME --password=$PYPI_API_TOKEN_PASSWORD
only:
- tags
build:
image: docker:latest
services:
- docker:dind
stage: build
script:
- echo "$DOCKER_HUB_PASSWORD" > dhpw.txt
- docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt docker.io
- docker pull $CI_REGISTRY_IMAGE:latest
- docker build --network=host --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
tags:
- gwas
only:
- master
- dev
build_release:
image: docker:latest
services:
- docker:dind
variables:
GIT_STRATEGY: none
stage: build
script:
- echo "$DOCKER_HUB_PASSWORD" > dhpw.txt
- docker login -u "${DOCKER_HUB_USER}" --password-stdin < dhpw.txt
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
tags:
- gwas
only:
- tags
deploy_prod:
extends: .before_script_template
stage: deploy
script:
- poetry build
- poetry publish --username=$PYPI_API_TOKEN_USERNAME --password=$PYPI_API_TOKEN_PASSWORD
only:
- tags