-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitlab-ci.yml
124 lines (112 loc) · 2.91 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
image: registry.gitlab.com/tobifinn/torch-assimilate
variables:
SPHINX_DOC_DIR: sphinx-doc
COVERAGE_STATIC_DIR: coverage-report
PAGES_DIR: public
DIST_DIR: dist
DEV_ENV_TEST: pytassim-dev-test
ENV_TEST: pytassim-test
DOCKER_REGISTRY: registry.gitlab.com
stages:
- install
- test
- package
- deploy
before_script:
- source activate pytassim-dev
build-docker:
stage: install
image: docker:latest
variables:
DOCKER_DRIVER: overlay
services:
- docker:dind
before_script: []
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $DOCKER_REGISTRY
- docker build -t $DOCKER_REGISTRY/tobifinn/torch-assimilate .
- docker push $DOCKER_REGISTRY/tobifinn/torch-assimilate
when: manual
check-envs:
stage: install
before_script:
- "conda remove --name $ENV_TEST --all || :"
- "conda remove --name $DEV_ENV_TEST --all || :"
after_script:
- "conda remove --name $ENV_TEST --all || :"
- "conda remove --name $DEV_ENV_TEST --all || :"
script:
- conda env create -f environment.yml --name $ENV_TEST
- conda env create -f dev_environment.yml --name $DEV_ENV_TEST
install-pytassim:
stage: install
script:
- python setup.py install
coverage:
stage: test
script:
- coverage run setup.py test
- coverage report
- coverage html
- mv htmlcov/ $COVERAGE_STATIC_DIR
coverage: '/TOTAL.*\s+(\d+\%)/'
artifacts:
paths:
- $COVERAGE_STATIC_DIR
expire_in: 1 week
sphinx:
stage: package
script:
- make docs && make docs
- mv docs/build/html $SPHINX_DOC_DIR
artifacts:
paths:
- $SPHINX_DOC_DIR
expire_in: 1 week
dist:
stage: package
dependencies: []
script:
- make dist
artifacts:
paths:
- dist/*
expire_in: 1 week
pages:
before_script: []
stage: deploy
dependencies:
- sphinx
- coverage
script:
- rm -rf $PAGES_DIR/ # make sure there is not pages dir
- mv $SPHINX_DOC_DIR $PAGES_DIR/ # sphinx doc is index page
- mv $COVERAGE_STATIC_DIR $PAGES_DIR/ # put coverage report inside
artifacts:
paths:
- $PAGES_DIR/
only:
- dev
pypi-upload:
stage: deploy
environment:
name: production
url: https://pypi.org/project/torch-assimilate/
script:
- twine upload -u "__token__" -p "$PYPI_TOKEN" dist/*
dependencies:
- dist
only:
- master
pypi-test-upload:
stage: deploy
environment:
name: testing
url: https://test.pypi.org/project/torch-assimilate/
script:
- twine upload -u "__token__" -p "$PYPI_TEST_TOKEN" --repository-url
https://test.pypi.org/legacy/ dist/*
dependencies:
- dist
only:
- tag