forked from dmlc/gluon-nlp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
94 lines (90 loc) · 3.06 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
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
stage("Sanity Check") {
node {
ws('workspace/gluon-nlp-lint') {
checkout scm
sh """#!/bin/bash
git clean -f -d -x
conda env update --prune -f env/pylint.yml -p conda/lint
conda activate ./conda/lint
conda list
make clean
make lint
"""
}
}
}
stage("Unit Test") {
parallel 'Python 2': {
node {
ws('workspace/gluon-nlp-py2') {
checkout scm
sh """#!/bin/bash
git clean -f -d -x --exclude='tests/externaldata/*' --exclude=conda
conda env update --prune -f env/py2.yml -p conda/py2
conda activate ./conda/py2
conda list
python -m spacy download en
python -m nltk.downloader all
make clean
python setup.py install
py.test -v --capture=no --durations=0 --cov=gluonnlp --cov=scripts tests/unittest scripts
"""
}
}
},
'Python 3': {
node {
withCredentials([string(credentialsId: 'GluonNLPCodeCov', variable: 'CODECOV_TOKEN')]) {
ws('workspace/gluon-nlp-py3') {
checkout scm
sh """#!/bin/bash
git clean -f -d -x --exclude='tests/externaldata/*' --exclude=conda
conda env update --prune -f env/py3.yml -p conda/py3
conda activate ./conda/py3
conda list
python -m spacy download en
python -m nltk.downloader all
make clean
python setup.py install
py.test -v --capture=no --durations=0 --cov=gluonnlp --cov=scripts tests/unittest scripts
EXIT_STATUS=\$?
bash ./codecov.sh
exit \$EXIT_STATUS
"""
}
}
}
}
}
stage("Deploy") {
node {
ws('workspace/gluon-nlp-docs') {
checkout scm
retry(3) {
sh """#!/bin/bash
printenv
git clean -f -d -x --exclude='tests/externaldata/*' --exclude=conda
conda env update --prune -f env/doc.yml -p conda/docs
conda activate ./conda/docs
conda list
python setup.py install
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
make clean
make docs
"""
}
if (env.BRANCH_NAME.startsWith("PR-")) {
sh """#!/bin/bash
echo "Uploading doc to s3://gluon-nlp-staging/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/"
aws s3 sync --delete docs/_build/html/ s3://gluon-nlp-staging/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/ --acl public-read
echo "Uploaded doc to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/index.html" """
pullRequest.comment("Job ${env.BRANCH_NAME}/${env.BUILD_NUMBER} is complete. \nDocs are uploaded to http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/index.html")
} else {
sh """#!/bin/bash
echo "Uploading doc to s3://gluon-nlp/${env.BRANCH_NAME}/"
aws s3 sync --delete docs/_build/html/ s3://gluon-nlp/${env.BRANCH_NAME}/ --acl public-read
echo "Uploaded doc to http://gluon-nlp.mxnet.io/${env.BRANCH_NAME}/index.html" """
}
}
}
}