-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
163 lines (141 loc) · 3.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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
image: condaforge/linux-anvil:latest
stages:
- build
- test
- deploy
# === Variables ===
variables:
PACKAGE_VERSION: 0.0.21
.py35: &py35
PYTHON_VERSION: "3.5"
.py36: &py36
PYTHON_VERSION: "3.6"
# === Build ===
.conda_configure: &conda_configure
before_script:
# Conda configure
- conda config --append channels bioconda
- conda config --append channels ostrokach-forge
- case "${PACKAGE_VERSION}" in
*dev*)
conda config --append channels kimlab/label/dev;
conda config --append channels kimlab;
conda config --append channels ostrokach/label/dev;
conda config --append channels ostrokach;
;;
*)
conda config --append channels kimlab;
conda config --append channels ostrokach;
;;
esac
.build: &build
stage: build
<<: *conda_configure
script:
# Build conda packages
- cd $CI_PROJECT_DIR/devtools/conda-recipe
- conda build --python $PYTHON_VERSION .
# Save built packages as artifacts
- mkdir $CI_PROJECT_DIR/conda-bld
- cp -r /opt/conda/conda-bld/{linux-64,noarch} $CI_PROJECT_DIR/conda-bld
artifacts:
paths:
- conda-bld
build-py35:
<<: *build
variables:
<<: [*py35]
build-py36:
<<: *build
variables:
<<: [*py36]
# === Test ===
.test: &test
stage: test
script:
# Conda install
- cp -r $CI_PROJECT_DIR/conda-bld/* /opt/conda/conda-bld/
- conda index /opt/conda/conda-bld/
- conda install -y -q --use-local "python=$PYTHON_VERSION" ${CI_PROJECT_NAME} >/dev/null
# Test
- pip install -q flake8 pytest pytest-cov codecov hypothesis
- flake8
- py.test
- conda env export -f $CI_PROJECT_DIR/environment-py${PYTHON_VERSION/./}.yml
coverage: /^TOTAL.*(\d+\%)/
artifacts:
paths:
- environment-py${PYTHON_VERSION/./}.yml
test-py35:
<<: [*conda_configure, *test]
dependencies:
- build-py35
variables:
<<: [*py35]
test-py36:
<<: [*conda_configure, *test]
dependencies:
- build-py36
variables:
<<: [*py36]
# === Pages ===
.docs: &docs
stage: test
script:
# Conda install
- cp -r $CI_PROJECT_DIR/conda-bld/* /opt/conda/conda-bld/
- conda index /opt/conda/conda-bld/
- conda install -y -q --use-local "python=$PYTHON_VERSION" $CI_PROJECT_NAME >/dev/null
# Build docs
- conda install -yq nbconvert ipython ipykernel pandoc
- pip install -q sphinx sphinx_rtd_theme recommonmark nbsphinx
- sphinx-build docs public
test-pages:
<<: [*conda_configure, *docs]
dependencies:
- build-py36
variables:
<<: [*py36]
except:
- master
- tags
pages:
<<: [*conda_configure, *docs]
dependencies:
- build-py36
variables:
<<: [*py36]
only:
- master
- tags
except:
- triggers
artifacts:
paths:
- public
# === Deploy ===
.deploy: &deploy
stage: deploy
script:
# Conda configure
- case "${PACKAGE_VERSION}" in
*dev*)
anaconda -t $ANACONDA_TOKEN upload $CI_PROJECT_DIR/conda-bld/linux-64/*.tar.bz2 -u ${CI_PROJECT_NAMESPACE} --label dev --force
;;
*)
anaconda -t $ANACONDA_TOKEN upload $CI_PROJECT_DIR/conda-bld/linux-64/*.tar.bz2 -u ${CI_PROJECT_NAMESPACE}
;;
esac
only:
- master
- tags
except:
- triggers
deploy-py35:
<<: *deploy
dependencies:
- build-py35
deploy-py36:
<<: *deploy
dependencies:
- build-py36