-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
111 lines (95 loc) · 2.72 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
image: topocourse/topocourse
stages:
- execute
- build
- deploy
execute_ipynbs:
stage: execute
script:
- export PYTHONPATH=$PYTHONPATH:${PWD}/code
- export OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 MKL_DYNAMIC=FALSE
- export DEST=generated/with_output
- mkdir -p $DEST
- cp syllabus.ipynb $DEST
- cp -r data $DEST
- cp -r w[!e]*_* $DEST
- jupyter nbconvert --to notebook --inplace --config scripts/config_filter_smudge.py $DEST/syllabus.ipynb
- find $DEST/w* -name '*.ipynb' | parallel --delay 3 --jobs 32 scripts/nbconvert.sh
- rm -rf $DEST/data
artifacts:
paths:
- generated/with_output
expire_in: 7d
mirror to github:
stage: execute
allow_failure: true
only:
- branches@qt/topocm
variables:
REPOS: "git@github.com:topocm/topocm_content.git"
before_script:
- HOSTS=$(for REPO in $REPOS; do echo ${REPO%:*} | cut -d'@' -f2; done)
- mkdir ~/.ssh && chmod 700 ~/.ssh
- for HOST in $HOSTS; do ssh-keyscan $HOST >> ~/.ssh/known_hosts; done
- echo "$PUSH_KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
after_script:
- rm -rf ~/.ssh
script:
- ORIGIN_URL=$(git config --get remote.origin.url)
- cd $(mktemp -d); git clone --bare $ORIGIN_URL .
- for REPO in $REPOS; do git push --mirror $REPO; done
edx archive:
stage: build
script: ./scripts/converter.py --silent ./generated/with_output
artifacts:
paths:
- generated/import_to_edx.tar.gz
- generated/html/edx
expire_in: 7d
pelican website:
stage: build
variables:
DEST: "generated/html"
script:
- python scripts/converter_pelican.py
- pelican -o $DEST/ -s website_assets/pelicanconf.py generated/pelican_content
- cp -r generated/with_output ${DEST}/notebooks
artifacts:
paths:
- generated/html
expire_in: 1d
ocw website:
stage: build
script:
- python scripts/converter_ocw.py
- mv website_assets/iframes.txt generated/html/ocw
artifacts:
paths:
- generated/html/ocw
expire_in: 1d
.upload_website: &upload_website
stage: deploy
before_script:
- mkdir -p ~/.ssh && ssh-keyscan tnw-tn1.tudelft.net >> ~/.ssh/known_hosts
- echo $WEBSITE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
script:
- "rsync -ravz --delete generated/html/* $USER@tnw-tn1.tudelft.net:"
- "rsync -ravz --delete website_assets/static $USER@tnw-tn1.tudelft.net:"
after_script:
- rm -rf ~/.ssh
upload test website:
<<: *upload_website
environment: test
only:
- branches@qt/topocm
except:
- master@qt/topocm
variables:
USER: topocm-test
upload main website:
<<: *upload_website
environment: published
only:
- master@qt/topocm
variables:
USER: topocm