forked from ElsevierSoftwareX/SOFTX-D-20-00087
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
148 lines (130 loc) · 4.21 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
variables:
GIT_STRATEGY: fetch
DOCKER_FILE: ${CI_PROJECT_DIR}/gitlab-utils/Dockerfile
DOCKER_TAG: latest
DOCKER_IMAGE: ${CI_REGISTRY_IMAGE}
stages:
- build
- test
- deploy
- release
prepare:
stage: build
before_script:
- docker version
- echo "${CI_REGISTRY_PASSWORD}" | docker login --password-stdin --username "${CI_REGISTRY_USER}" "${CI_REGISTRY}"
script:
- mkdir -p /.docker
- docker build -f ${DOCKER_FILE} -t ${DOCKER_IMAGE}:${DOCKER_TAG} /.docker
- docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
tags:
- docker
test-prerequisites:
stage: test
image: ${DOCKER_IMAGE}
script:
- python3.6 -m pytest -q /opt/richardsonpy/.
- python3.6 -m pytest -q /opt/pycity_base/.
tags:
- docker
unittest-gurobi:
stage: test
image: ${DOCKER_IMAGE}
script:
- mv $GUROBI_LIC /opt/gurobi/gurobi.lic
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
- ln -s $CI_PROJECT_DIR/README.md $CI_PROJECT_DIR/src/README.md
- python3.6 -m pip install --no-cache-dir $CI_PROJECT_DIR/src/.
- python3.6 -m unittest discover -s $CI_PROJECT_DIR/src/testing/unit_tests -v
tags:
- docker
unittest-scip:
stage: test
image: ${DOCKER_IMAGE}
script:
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
- ln -s $CI_PROJECT_DIR/README.md $CI_PROJECT_DIR/src/README.md
- sed -i '55s/GUROBI_DIRECT_SOLVER/SCIP_SOLVER/g' $CI_PROJECT_DIR/src/pycity_scheduling/solvers.py
- sed -i '56s/GUROBI_DIRECT_SOLVER_OPTIONS/SCIP_SOLVER_OPTIONS/g' $CI_PROJECT_DIR/src/pycity_scheduling/solvers.py
- python3.6 -m pip install --no-cache-dir $CI_PROJECT_DIR/src/.
- python3.6 -m unittest discover -s $CI_PROJECT_DIR/src/testing/unit_tests -v
tags:
- docker
lint:
stage: test
image: ${DOCKER_IMAGE}
script:
- mkdir -p lint
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
- ln -s $CI_PROJECT_DIR/README.md $CI_PROJECT_DIR/src/README.md
- python3.6 -m pip install --no-cache-dir $CI_PROJECT_DIR/src/.
- pylint --rcfile=$CI_PROJECT_DIR/gitlab-utils/.pylintrc pycity_scheduling > $CI_PROJECT_DIR/gitlab-utils/pylint_report.txt || true
- tail -n 2 $CI_PROJECT_DIR/gitlab-utils/pylint_report.txt
- mv $CI_PROJECT_DIR/gitlab-utils/pylint_report.txt lint
artifacts:
name: "pycity_scheduling-pylint-report-$CI_COMMIT_SHORT_SHA"
paths:
- lint
expire_in: 4 weeks
when: always
tags:
- docker
docs:
stage: deploy
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_TAG =~ /^v/'
image: ${DOCKER_IMAGE}
script:
- mkdir -p docs
- rm -rf docs/*
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
- ln -s $CI_PROJECT_DIR/README.md $CI_PROJECT_DIR/src/README.md
- python3.6 -m pip install --no-cache-dir $CI_PROJECT_DIR/src/.
- bash $CI_PROJECT_DIR/gitlab-utils/sphinx_doc/docu.sh
- mv $CI_PROJECT_DIR/gitlab-utils/sphinx_doc/_build/html/* docs
artifacts:
name: "pycity_scheduling-docs-$CI_COMMIT_SHORT_SHA"
paths:
- docs
expire_in: 365 days
when: always
tags:
- docker
pages:
stage: deploy
rules:
- if: '$CI_COMMIT_TAG =~ /^v/'
when: delayed
start_in: '60 minutes'
image: ${DOCKER_IMAGE}
script:
- mkdir -p public
- mv $CI_PROJECT_DIR/docs/* public
artifacts:
paths:
- public
tags:
- docker
pypi-release:
stage: release
rules:
- if: '$CI_COMMIT_TAG =~ /^v/'
when: delayed
start_in: '120 minutes'
image: ${DOCKER_IMAGE}
script:
- mkdir -p release
- ln -s $CI_PROJECT_DIR/LICENSE.txt $CI_PROJECT_DIR/src/LICENSE.txt
- ln -s $CI_PROJECT_DIR/README.md $CI_PROJECT_DIR/src/README.md
- mkdir -p $CI_PROJECT_DIR/_release
- cp -ar $CI_PROJECT_DIR/src/. $CI_PROJECT_DIR/_release/
- python3.6 $CI_PROJECT_DIR/_release/setup.py sdist -d $CI_PROJECT_DIR/_release/dist
- python3.6 $CI_PROJECT_DIR/_release/setup.py bdist_wheel -d $CI_PROJECT_DIR/_release/dist
- TWINE_PASSWORD=${CI_PYPI_TOKEN} TWINE_USERNAME=__token__ python3.6 -m twine upload $CI_PROJECT_DIR/_release/dist/*
- mv $CI_PROJECT_DIR/_release/dist/* release
artifacts:
name: "pycity_scheduling-release-$CI_COMMIT_TAG"
paths:
- release
tags:
- docker