-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
191 lines (176 loc) · 4.41 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
stages:
- virtual-env
- testing
- linting
- documentation
- evaluation
image: conda/miniconda3
before_script:
# Apparently envs in Gitlab runners have to be activated like this
# See https://stackoverflow.com/questions/57754356/activating-conda-environment-during-gitlab-ci
- source activate ./venv
# Set up venv on default runner
# Only (re-)create env when the definition has changed or
# when no cached version is available.
virtual-env-default-build:
stage: virtual-env
before_script: []
script:
- if ! test -e "venv"; then conda env create --force --prefix ./venv -f environment.yml; fi
cache:
key: venv-cache-default
paths:
- venv/
rules:
- changes:
- environment.yml
- .gitlab-ci.yml
when: never
- when: always
artifacts:
paths:
- venv/
expire_in: 1 hour
# Set up venv on default runner
# Only (re-)create env when the definition has changed or
# when no cached version is available.
virtual-env-default-rebuild:
stage: virtual-env
before_script: []
script:
- conda env create --force --prefix ./venv -f environment.yml
cache:
key: venv-cache-default
paths:
- venv/
rules:
- changes:
- environment.yml
- .gitlab-ci.yml
artifacts:
paths:
- venv/
expire_in: 1 hour
# Set up venv on default runner
# Only (re-)create env when the definition has changed or
# when no cached version is available.
virtual-env-ryzen-build:
stage: virtual-env
tags:
- ryzen
before_script: []
script:
- if ! test -e "venv"; then conda env create --force --prefix ./venv -f environment.yml; fi
cache:
key: venv-cache-default
paths:
- venv/
rules:
- changes:
- environment.yml
- .gitlab-ci.yml
when: never
- when: always
artifacts:
paths:
- venv/
expire_in: 1 hour
# Set up venv on default runner
# Only (re-)create env when the definition has changed or
# when no cached version is available.
virtual-env-ryzen-rebuild:
stage: virtual-env
tags:
- ryzen
before_script: []
script:
- conda env create --force --prefix ./venv -f environment.yml
cache:
key: venv-cache-default
paths:
- venv/
rules:
- changes:
- environment.yml
- .gitlab-ci.yml
artifacts:
paths:
- venv/
expire_in: 1 hour
clean-code:
stage: linting
dependencies:
- virtual-env-default-rebuild
- virtual-env-default-build
rules:
- if: '$CI_COMMIT_MESSAGE =~ /.*\[no lint\].*/'
when: never
- when: always
script:
- pylint agent_code/koetherminator
- flake8 agent_code/koetherminator
# Please add all directories you make changes to
# Ordinary unit-tests. Will be run within our game setup.
unit-test:
stage: testing
dependencies:
- virtual-env-default-rebuild
- virtual-env-default-build
script:
- python -m unittest discover -s tests
# Test that validate timing and are hardware dependent.
# Will be executed on AMD Ryzen™ 7 PRO 3700.
speed-test:
stage: testing
tags:
- ryzen
dependencies:
- virtual-env-ryzen-rebuild
- virtual-env-ryzen-build
script:
- python -m unittest discover -s timed_tests
# Tests that validate compatibility with tournament setup.
# Will be exectuted in unaltered version of the game setup.
integration-test:
stage: testing
dependencies:
- virtual-env-default-rebuild
- virtual-env-default-build
script:
- git clone https://github.com/ukoethe/bomberman_rl.git
- cp -a agent_code/koetherminator/. bomberman_rl/agent_code/koetherminator/
- cp -a integration_tests/. bomberman_rl/integration_tests/
# clean up just in case
- find . ! \( -path './bomberman_rl*' -or -path './venv*' \) -delete
- cd bomberman_rl
- python -m unittest discover -s integration_tests
# Generates docs (Master branch only)
# TODO
.documentation:
stage: documentation
dependencies:
- virtual-env-default-rebuild
- virtual-env-default-build
script:
-
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
artifacts:
paths:
- build/
# Evaluates the performance of the agent (Master branch only)
# Will be executed on AMD Ryzen™ 7 PRO 3700.
evaluation:
stage: evaluation
tags:
- ryzen
dependencies:
- virtual-env-ryzen-rebuild
- virtual-env-ryzen-build
script:
- python evaluate.py
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
artifacts:
paths:
- results/