forked from hyperledger-labs/crypto-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.ci
108 lines (89 loc) · 2.98 KB
/
Jenkinsfile.ci
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
#!groovy
testing()
def testing() {
stage('Testing') {
parallel([
'ubuntu-test' : { ubuntuTesting() },
'windows-test': { windowsTesting() }
])
}
}
def ubuntuTesting() {
node('ubuntu') {
stage('Ubuntu Test') {
linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu")
}
}
}
def windowsTesting() {
node('win2016') {
stage('Windows Test') {
def ws_path = "workspace/${env.JOB_NAME}".replace(' ', '_')
ws(ws_path) {
try {
echo "Windows Test: Checkout scm"
checkout scm
setupRust()
dir('libindy-crypto') {
echo "Windows Test: Download prebuilt dependencies"
bat 'wget -O prebuilt.zip "https://repo.sovrin.org/windows/libindy_crypto/deps/indy-crypto-deps.zip"'
bat 'unzip prebuilt.zip -d prebuilt'
echo "Windows Test: Build"
withEnv([
"OPENSSL_DIR=$WORKSPACE\\libindy-crypto\\prebuilt",
"INDY_CRYPTO_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy-crypto\\prebuilt",
"RUST_BACKTRACE=1"
]) {
bat "cargo test --no-run"
echo "Windows Test: Run tests"
withEnv(["RUST_LOG=trace"]) {
bat "cargo test"
}
}
}
//TODO wrappers testing
} finally {
cleanWs()
}
}
cleanWs()
}
}
}
def linuxTesting(file, env_name) {
try {
echo "${env_name} Test: Checkout csm"
checkout scm
def testEnv
dir('libindy-crypto') {
echo "${env_name} Test: Build docker image"
testEnv = docker.build("libindy-crypto-test", "--build-arg uid=${getUserUid()} -f $file")
testEnv.inside {
echo "${env_name} Test: Test"
echo "${env_name} Test: Build"
sh "RUST_BACKTRACE=1 cargo test --no-run"
echo "${env_name} Test: Run tests"
sh "RUST_BACKTRACE=1 RUST_LOG=trace cargo test"
}
}
sh "cp libindy-crypto/target/debug/libindy_crypto.so wrappers/python"
dir('wrappers/python') {
testEnv.inside {
echo "${env_name} Test: Test python wrapper"
sh '''
python3.5 -m pip install --user -e .
LD_LIBRARY_PATH=./ RUST_LOG=trace python3.5 -m pytest
'''
}
}
}
finally {
step([$class: 'WsCleanup'])
}
}
def getUserUid() {
return sh(returnStdout: true, script: 'id -u').trim()
}
def setupRust() {
sh "rustup default 1.25.0"
}