-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
246 lines (231 loc) · 6.42 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
variables:
DOCKER_TAG: $CI_COMMIT_REF_SLUG
DOCKER_IMAGE_DEV: plf
DOCKER_IMAGE_PLF: $CI_REGISTRY_IMAGE/${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
DOCKER_IMAGE_DOCS: $CI_REGISTRY_IMAGE/${DOCKER_IMAGE_DEV}_docs:${DOCKER_TAG}
# workflow:
# rules:
# - if: $CI_COMMIT_BRANCH == "develop" && $CI_COMMIT_MESSAGE
# - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "api"
# - if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "web"
stages:
- prepare
- check
- lint
- training
- evaluation
- oracles:deploy
- pdoc
- build
- deploy
## Prepare Jobs:
docker-plf:
stage: prepare
environment:
name: proloaf
script:
- echo $CI_PROJECT_DIR/${DOCKER_FILE}
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build
--file $CI_PROJECT_DIR/${DOCKER_FILE}
--tag ${DOCKER_IMAGE_PLF} .
- docker push ${DOCKER_IMAGE_PLF}
tags:
- docker
docker-docs:
stage: prepare
environment:
name: docs
script:
- echo $CI_PROJECT_DIR/${DOCKER_FILE}
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build
--file $CI_PROJECT_DIR/${DOCKER_FILE}
--tag ${DOCKER_IMAGE_DOCS} .
- docker push ${DOCKER_IMAGE_DOCS}
tags:
- docker
prep-docs:
stage: pdoc
image: ${DOCKER_IMAGE_PLF}
script:
- pip3 install --no-cache-dir pdoc
# - pip3 install -e .
- pdoc -o ./docs/static/reference/proloaf -t . -d numpy proloaf
- ls -l ./docs/static/reference/proloaf
artifacts:
expire_in: 1 day
when: on_success
name: pdoc
paths:
- docs/static/reference/proloaf
tags:
- docker
needs:
- docker-plf
### DCO Checker
dco:
stage: check
script:
- pip3 install -U dco-check
- export CI_DEFAULT_BRANCH="develop"
- dco-check -v
allow_failure: true
image: christophebedard/dco-check:latest
rules:
- if: $CI_PIPELINE_SOURCE == 'push'
needs: []
lint_all:
stage: lint
image: ${DOCKER_IMAGE_PLF}
allow_failure: true
script:
- pip install flake8
- flake8 --output-file flake8_lint.txt src
# - chmod +x ./shell/lint_script.sh
# - ./shell/lint_script.sh
artifacts:
when: always
name: proloaf
expire_in: 1 hour
reports:
junit: ./flake8_lint.xml
paths:
- ./oracles/*
- ./flake8_lint.txt
# - ./flake8_lint.xml
tags:
- docker
rules:
- if: $CI_PIPELINE_SOURCE == 'push'
### Test Training Jobs
test_train:
stage: training
script:
- bash -c "[ $CI_PIPELINE_SOURCE == 'web' ] || [ $CI_PIPELINE_SOURCE == 'api' ] || [ $CI_COMMIT_BRANCH == 'master' ] || python3 ./shell/adjust_config_for_technical_test.py ./targets/${CI_STATION}/config.json"
- python3 src/train.py -s $CI_STATION
artifacts:
when: on_success
name: proloaf
expire_in: 1 day
paths:
- ./oracles/*
- ./logs/**/*
- ./logs/*
- ./runs/**/*
- ./runs/**/**/*
image: ${DOCKER_IMAGE_PLF}
needs:
- docker-plf
tags:
- docker
# ### Test Evaluation Jobs
test_eval:
stage: evaluation
script:
- python3 src/evaluate.py -s $CI_STATION
artifacts:
name: proloaf
when: on_success
expire_in: 1 day
paths:
- ./oracles/**/*
exclude:
- ./oracles/*.pkl
image: ${DOCKER_IMAGE_PLF}
tags:
- docker
# only:
# variables:
# - $CI_PIPELINE_SOURCE == 'push'
# ## Deploy Results of latest Runs to Oracles
push_to_oracles:
stage: oracles:deploy
script:
- TIMESTAMP=$(python shell/return_timestamp.py)
- git clone https://gonca.guerses.tran:[email protected]/acs/public/automation/plf/plf-oracles.git ./repo/
- git config --global user.email "[email protected]"
- git config --global user.name "GitLab CI train"
- mkdir -p ./repo/$CI_STATION/$TIMESTAMP
- mkdir ./repo/$CI_STATION/$TIMESTAMP/logs
- mkdir ./repo/$CI_STATION/$TIMESTAMP/runs
- mkdir ./repo/$CI_STATION/$TIMESTAMP/model
# - mv logs/* ./repo/$CI_STATION/$TIMESTAMP/logs/
- mv runs/* ./repo/$CI_STATION/$TIMESTAMP/runs/
- touch ./repo/$CI_STATION/$TIMESTAMP/index.md
- python shell/create_hugo_header.py --date=$TIMESTAMP --title="$CI_STATION $TIMESTAMP" --link=$TIMESTAMP --imginclude==True >> ./repo/$CI_STATION/$TIMESTAMP/index.md
- echo "[Source Pipeline](https://git.rwth-aachen.de/acs/public/automation/plf/proloaf/-/pipelines/$CI_PIPELINE_ID)" >> ./repo/$CI_STATION/$TIMESTAMP/index.md
- echo "" >> ./repo/$CI_STATION/$TIMESTAMP/index.md
- cat oracles/result_page_content.md >> ./repo/$CI_STATION/$TIMESTAMP/index.md
- mv oracles/*/* oracles/
- mv oracles/* ./repo/$CI_STATION/$TIMESTAMP/model/
#- chmod +x ./shell/make_station_folder_index.sh
#- ./shell/make_station_folder_index.sh
- python ./shell/make_station_folder_index.py $CI_STATION
- cd ./repo/
- git add *
- git commit -m "New Training Resutls for $CI_STATION from GitLab CI"
- git push
- cd ..
- touch link_to_results.txt
- echo "<a href=\"https://acs.pages.rwth-aachen.de/public/automation/plf/proloaf/docs/results/plf-oracles/$CI_STATION/$TIMESTAMP\">Results</a>" >> link_to_results.html
#- chmod +x ./shell/trigger_docs_pipeline
#- ./shell/trigger_docs_pipeline
artifacts:
when: always
expire_in: 1 days
name: proloaf
paths:
- ./repo/$CI_STATION/**/**/*
- ./link_to_results.html
image: ${DOCKER_IMAGE_PLF}
tags:
- docker
needs:
- test_eval
rules:
- if: $CI_PIPELINE_SOURCE == 'web'
- if: $CI_PIPELINE_SOURCE == 'api'
- if: $CI_COMMIT_BRANCH == 'master'
hugo:
stage: build
image: ${DOCKER_IMAGE_DOCS}
script:
- cd docs
- npm install -D postcss
- npm install -D --save autoprefixer
- npm install -D --save postcss-cli
# - echo $PWD
- mkdir -p content/en/results/
- cd content/en/results/
- git clone https://gonca.guerses.tran:[email protected]/acs/public/automation/plf/plf-oracles.git
- cd ../../..
- hugo -v
- ls -l
artifacts:
when: on_success
name: hugo
paths:
- docs/public
#- docs/content/en/results/*
only:
- master
pages:
stage: deploy
script:
#- cd docs
- mkdir public
- mkdir -p ./public/content/en/results
- ls -l
- cp -r ./docs/public/* public
- ls ./docs
- ls ./docs/public
- cp -r ./docs/public/results/* public/content/en/results/
artifacts:
name: hugo
paths:
- public
tags:
- docker
rules:
- if: $CI_COMMIT_BRANCH == 'master'