-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
407 lines (369 loc) · 9.15 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
image: comp2310/assignment_2:latest
variables:
backticks: "```"
MAX_LINES: 25
stages:
- filecheck
- build
- test
- render
build_db_server:
allow_failure: true
stage: build
tags:
- comp2300
artifacts:
when: always
paths:
- tests/
- db_server
- run_tests.sh
- send_requests.sh
script:
- cd /files/
- cp -f -r tests/. "$CI_PROJECT_DIR/tests/"
- cp -f run_tests.sh "$CI_PROJECT_DIR"
- cp -f send_requests.sh "$CI_PROJECT_DIR"
- cd $CI_PROJECT_DIR
- make clean
- make all
.runtest:
timeout: 10 minutes
allow_failure: true
needs:
- job: build_db_server
artifacts: true
stage: test
tags:
- comp2300
script:
- RETCODE=0
- touch ${TEST_FILE}
- ./run_tests.sh -v -t ${TEST_NAME} > ${TEST_FILE} 2>&1 || RETCODE=$?
- printf "%s\n" "Result of running test ${TEST_NAME}:"
- cat ${TEST_FILE}
- >
if [ "${RETCODE}" != "0" ]; then
exit 1
fi
single_node_1:
extends: .runtest
variables:
TEST_NAME: single_node_1
TEST_FILE: single_node_1_result
artifacts:
when: always
paths:
- ${TEST_FILE}
single_node_2:
extends: .runtest
variables:
TEST_NAME: single_node_2
TEST_FILE: single_node_2_result
artifacts:
when: always
paths:
- ${TEST_FILE}
single_node_3:
extends: .runtest
variables:
TEST_NAME: single_node_3
TEST_FILE: single_node_3_result
artifacts:
when: always
paths:
- ${TEST_FILE}
single_node_4:
extends: .runtest
variables:
TEST_NAME: single_node_4
TEST_FILE: single_node_4_result
artifacts:
when: always
paths:
- ${TEST_FILE}
multi_node_1:
extends: .runtest
variables:
TEST_NAME: multi_node_1
TEST_FILE: multi_node_1_result
artifacts:
when: always
paths:
- ${TEST_FILE}
multi_node_2:
extends: .runtest
variables:
TEST_NAME: multi_node_2
TEST_FILE: multi_node_2_result
artifacts:
when: always
paths:
- ${TEST_FILE}
multi_node_3:
extends: .runtest
variables:
TEST_NAME: multi_node_3
TEST_FILE: multi_node_3_result
artifacts:
when: always
paths:
- ${TEST_FILE}
multi_node_4:
extends: .runtest
variables:
TEST_NAME: multi_node_4
TEST_FILE: multi_node_4_result
artifacts:
when: always
paths:
- ${TEST_FILE}
parallel_1:
extends: .runtest
variables:
TEST_NAME: parallel_1
TEST_FILE: parallel_1_result
artifacts:
when: always
paths:
- ${TEST_FILE}
parallel_2:
extends: .runtest
variables:
TEST_NAME: parallel_2
TEST_FILE: parallel_2_result
artifacts:
when: always
paths:
- ${TEST_FILE}
parallel_3:
extends: .runtest
variables:
TEST_NAME: parallel_3
TEST_FILE: parallel_3_result
artifacts:
when: always
paths:
- ${TEST_FILE}
statement-of-originality:
image: brentschuetze/comp2300-microbit-test:latest
stage: filecheck
allow_failure: true
tags:
- comp2300
artifacts:
when: always
paths:
- references.md
reports:
dotenv: student.env
script:
- python3 /scripts/validate.py get-student statement-of-originality.md
- python3 /scripts/validate.py get-content statement-of-originality.md -C references.md
- python3 /scripts/validate.py schema ./statement-of-originality.md https://comp.anu.edu.au/courses/comp1720/assets/schemas/soo-md.json
report:
image: brentschuetze/comp2300-microbit-test:latest
stage: filecheck
allow_failure: true
tags:
- comp2300
script:
- python3 /scripts/validate.py exists report.md
- var="$(cat report.md | wc -w)"
- >
echo "Word Count: $var"
- >
if (( $var > 300)); then
exit 0;
else
echo "Your report should probably be more than 300 words!";
exit 1;
fi
pdf:
stage: render
tags:
- comp2300
image:
name: brentschuetze/comp2300-md2pdf:latest
needs:
- job: single_node_1
artifacts: true
- job: single_node_2
artifacts: true
- job: single_node_3
artifacts: true
- job: single_node_4
artifacts: true
- job: multi_node_1
artifacts: true
- job: multi_node_2
artifacts: true
- job: multi_node_3
artifacts: true
- job: multi_node_4
artifacts: true
- job: parallel_1
artifacts: true
- job: parallel_2
artifacts: true
- job: parallel_3
artifacts: true
- job: statement-of-originality
artifacts: true
- job: report
artifacts: true
variables:
PDF_NAME: '$CI_PROJECT_ROOT_NAMESPACE-$CI_PROJECT_NAME.pdf'
assignment_name: Assignment 2
script:
- touch pdf.md
# Check ENV Vars
- echo $PDF_NAME
- echo $STUDENT_NAME
- echo $STUDENT_UID
- echo "REFERENCES:"
- cat references.md
# Build pdf.md
## Preamble
- echo "---" > pdf.md
- echo "pdf_options:" >> pdf.md
- |
echo " displayHeaderFooter: true" >> pdf.md
- |
echo " format: A4" >> pdf.md
- |
echo " margin: 25mm" >> pdf.md
- |
echo " printBackground: true" >> pdf.md
- |
echo " headerTemplate: |-" >> pdf.md
- echo " <style>" >> pdf.md
- echo " section {" >> pdf.md
- |
echo " display: block;" >> pdf.md
- |
echo " margin: 0 auto;" >> pdf.md
- |
echo " padding-left: 13mm;" >> pdf.md
- |
echo " padding-right: 13mm;" >> pdf.md
- |
echo " width: 100%;" >> pdf.md
- |
echo " font-size: 8px;" >> pdf.md
- echo " }" >> pdf.md
- echo " .lleft {" >> pdf.md
- |
echo " float: left;" >> pdf.md
- echo " }" >> pdf.md
- echo " .rright {" >> pdf.md
- |
echo " float: right;" >> pdf.md
- echo " }" >> pdf.md
- echo " </style>" >> pdf.md
- echo " <section>" >> pdf.md
- echo ' <span class="title lleft"></span>' >> pdf.md
- echo ' <span class="date rright"></span>' >> pdf.md
- echo " </section>" >> pdf.md
- |
echo " footerTemplate: |-" >> pdf.md
- echo " <section>" >> pdf.md
- echo ' <div class="rright">' >> pdf.md
- echo ' <span class="pageNumber"></span>' >> pdf.md
- echo ' / <span class="totalPages"></span>' >> pdf.md
- echo " </div>" >> pdf.md
- echo " </section>" >> pdf.md
- echo "---" >> pdf.md
# Build pdf.md
- echo "# $assignment_name" >> pdf.md
- echo "## Student Details" >> pdf.md
- >
echo "- **uid**: $STUDENT_UID" >> pdf.md
- >
echo "- **name**: $STUDENT_NAME" >> pdf.md
- echo "" >> pdf.md
# Test Names
- single_node_tests="single_node_1 single_node_2 single_node_3 single_node_4"
- multi_node_tests="multi_node_1 multi_node_2 multi_node_3"
- parallel_tests="parallel_1 parallel_2 parallel_3"
- echo "## Single Node Tests" >> pdf.md
- echo "" >> pdf.md
- for t in ${single_node_tests}; do
- echo "" >> pdf.md
- echo "### ${t}" >> pdf.md
- echo "" >> pdf.md
- file_name="${t}_result"
- touch ${file_name}
- LINES=$(wc -l < ${file_name})
- printf "%s\n" $backticks >> pdf.md
- head -n ${MAX_LINES} ${file_name} >> pdf.md
- >
if [ $LINES -gt $MAX_LINES ]; then
echo "..." >> pdf.md
fi
- echo "" >> pdf.md
- printf "%s\n" $backticks >> pdf.md
- done
- echo "## Multiple Nodes Tests" >> pdf.md
- echo "" >> pdf.md
- for t in ${multi_node_tests}; do
- echo "" >> pdf.md
- echo "### ${t}" >> pdf.md
- echo "" >> pdf.md
- file_name="${t}_result"
- touch ${file_name}
- LINES=$(wc -l < ${file_name})
- printf "%s\n" $backticks >> pdf.md
- head -n ${MAX_LINES} ${file_name} >> pdf.md
- >
if [ $LINES -gt $MAX_LINES ]; then
echo "..." >> pdf.md
fi
- echo "" >> pdf.md
- printf "%s\n" $backticks >> pdf.md
- done
- echo "## Parallel Tests" >> pdf.md
- echo "" >> pdf.md
- for t in ${parallel_tests}; do
- echo "" >> pdf.md
- echo "### ${t}" >> pdf.md
- echo "" >> pdf.md
- file_name="${t}_result"
- touch ${file_name}
- LINES=$(wc -l < ${file_name})
- printf "%s\n" $backticks >> pdf.md
- head -n ${MAX_LINES} ${file_name} >> pdf.md
- >
if [ $LINES -gt $MAX_LINES ]; then
echo "..." >> pdf.md
fi
- echo "" >> pdf.md
- printf "%s\n" $backticks >> pdf.md
- done
- echo "" >> pdf.md
# Report
- echo "<div class='page-break'> </div>" >> pdf.md
- echo "" >> pdf.md
- cat report.md >> pdf.md
- echo "" >> pdf.md
- echo "" >> pdf.md
## References
- echo "" >> pdf.md
- echo "<div class='page-break'> </div>" >> pdf.md
- echo "" >> pdf.md
- cat references.md >> pdf.md
- echo "" >> pdf.md
# Final md doc
- cat pdf.md
# Render
- |
md-to-pdf --launch-options '{ "args": ["--no-sandbox"] }' \
--highlight-style 'vs2015' \
--document-title "$assignment_name" \
--css 'body { font-family: helvetica }' \
pdf.md
- mv pdf.pdf "$PDF_NAME"
artifacts:
when: always
paths:
- $PDF_NAME