forked from d2l-ai/d2l-en
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
61 lines (53 loc) · 1.73 KB
/
Jenkinsfile
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
stage("Build and Publish") {
def TASK = "d2l-en"
node {
ws("workspace/${TASK}") {
checkout scm
def ENV_NAME = "${TASK}-${EXECUTOR_NUMBER}";
def EID = EXECUTOR_NUMBER.toInteger()
def CUDA_VISIBLE_DEVICES=(EID*2).toString() + ',' + (EID*2+1).toString();
sh label: "Build Environment", script: """set -ex
rm -rf ~/miniconda3/envs/${ENV_NAME}
conda create -n ${ENV_NAME} pip python=3.7 -y
conda activate ${ENV_NAME}
pip install mxnet-cu101==1.6.0
pip install git+https://github.com/d2l-ai/d2l-book
python setup.py develop
pip list
nvidia-smi
"""
sh label: "Check Execution Output", script: """set -ex
conda activate ${ENV_NAME}
d2lbook build outputcheck
"""
sh label: "Execute Notebooks", script: """set -ex
conda activate ${ENV_NAME}
export CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64
d2lbook build eval
"""
sh label:"Build HTML", script:"""set -ex
conda activate ${ENV_NAME}
./static/build_html.sh
"""
sh label:"Build PDF", script:"""set -ex
conda activate ${ENV_NAME}
d2lbook build pdf
"""
sh label:"Build Package", script:"""set -ex
conda activate ${ENV_NAME}
# don't pack downloaded data into the pkg
rm -rf _build/data_tmp
[ -e _build/eval/data ] && mv _build/eval/data _build/data_tmp
d2lbook build pkg
[ -e _build/data_tmp ] && mv _build/data_tmp _build/eval/data
"""
if (env.BRANCH_NAME == 'master') {
sh label:"Publish", script:"""set -ex
conda activate ${ENV_NAME}
d2lbook deploy html pdf pkg
"""
}
}
}
}