Skip to content

Commit 85623cd

Browse files
authored
Merge pull request hyperledger-indy#767 from Artemkaaas/feature/cli-payment-support
Updated CI Pipeline to run Cli Payment tests
2 parents 390b982 + bc57d44 commit 85623cd

File tree

14 files changed

+734
-142
lines changed

14 files changed

+734
-142
lines changed

Jenkinsfile.cd

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def getBuildPoolVerOptions(pool_type, plenum_ver, anoncreds_ver, node_ver) {
9797
def dockerClean(env_name, network_name) {
9898
try {
9999
try {
100-
sh "docker ps --format '{{.ID}}' --filter network=${network_name} | xargs docker rm -f || true" //TODO: FIXME
100+
sh "docker ps --format '{{.ID}}' --filter network=${network_name} | xargs docker rm -f || true"
101+
//TODO: FIXME
101102
} catch (error) {
102103
echo "${env_name} Test: error while force clean-up network ${network_name} - ${error}"
103104
}
@@ -173,7 +174,7 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) {
173174
sh "RUST_BACKTRACE=1 cargo test --release --no-run"
174175

175176
echo "${env_name} Libindy Test: Run tests"
176-
sh "RUST_BACKTRACE=1 RUST_LOG=indy::,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release"
177+
sh "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release"
177178

178179
if (stashBuildResults) {
179180
stash includes: 'target/release/libindy.so,target/release/libindy.a', name: 'LibindyUbuntuBuildResult'
@@ -196,7 +197,7 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) {
196197
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
197198
echo "${env_name} Libindy Test: Test java wrapper"
198199

199-
sh "RUST_LOG=indy::,zmq=trace TEST_POOL_IP=10.0.0.2 mvn clean test"
200+
sh "RUST_LOG=indy::=debug,zmq=trace TEST_POOL_IP=10.0.0.2 mvn clean test"
200201
}
201202
}
202203

@@ -207,37 +208,40 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) {
207208

208209
sh '''
209210
python3.5 -m pip install --user -e .
210-
LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_LOG=indy::,zmq=trace TEST_POOL_IP=10.0.0.2 python3.5 -m pytest
211+
LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_LOG=indy::=debug,zmq=trace TEST_POOL_IP=10.0.0.2 python3.5 -m pytest
211212
'''
212213
}
213214
}
214215

215-
sh "cp libindy/target/release/libindy.so cli"
216-
dir('cli') {
216+
sh "cp libindy/target/release/libindy.so libnullpay"
217+
dir('libnullpay') {
217218
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
218-
echo "${env_name} Indy Cli Test: Build"
219+
echo "${env_name} Indy Libnullpay Test: Build"
219220
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release"
220221

221-
echo "${env_name} Indy Cli Test: Build Tests"
222-
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --no-run"
223-
224-
echo "${env_name} Indy Cli Test: Run tests"
225-
sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release'
226-
227222
if (stashBuildResults) {
228-
stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult'
223+
stash includes: 'target/release/libnullpay.so', name: 'LibnullpayUbuntuBuildResult'
229224
}
230225
}
231226
}
232227

233-
sh "cp libindy/target/release/libindy.so libnullpay"
234-
dir('libnullpay') {
235-
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
236-
echo "${env_name} Indy Libnullpay Test: Build"
237-
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release"
228+
if (env_name == 'Ubuntu') { // TODO: Delete condition IS-702
229+
sh "cp libnullpay/target/release/libnullpay.so cli"
230+
sh "cp libindy/target/release/libindy.so cli"
231+
dir('cli') {
232+
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
233+
echo "${env_name} Indy Cli Test: Build"
234+
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release"
238235

239-
if (stashBuildResults) {
240-
stash includes: 'target/release/libnullpay.so', name: 'LibnullpayUbuntuBuildResult'
236+
echo "${env_name} Indy Cli Test: Build Tests"
237+
sh 'LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --features "nullpay_plugin" --no-run'
238+
239+
echo "${env_name} Indy Cli Test: Run tests"
240+
sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "nullpay_plugin"'
241+
242+
if (stashBuildResults) {
243+
stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult'
244+
}
241245
}
242246
}
243247
}
@@ -285,7 +289,7 @@ def windowsTesting() {
285289
echo "Windows Libindy Test: Run tests"
286290
withEnv([
287291
"RUST_TEST_THREADS=1",
288-
"RUST_LOG=indy::,zmq=trace",
292+
"RUST_LOG=indy::=debug,zmq=trace",
289293
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
290294
]) {
291295
bat "cargo test --release"
@@ -294,47 +298,46 @@ def windowsTesting() {
294298
stash includes: 'target/release/*.dll', name: 'LibindyWindowsBuildResult'
295299
}
296300

297-
bat "copy $WORKSPACE\\libindy\\target\\release\\indy.dll $WORKSPACE\\libindy\\prebuilt\\lib"
298-
bat "copy $WORKSPACE\\libindy\\target\\release\\indy.lib $WORKSPACE\\libindy\\prebuilt\\lib"
301+
dir('libnullpay') {
302+
echo "Windows Libnullpay Test: Build"
303+
withEnv([
304+
"RUST_BACKTRACE=1"
305+
]) {
306+
bat "cargo build --release"
307+
}
308+
309+
stash includes: 'target/release/*.dll', name: 'LibnullpayWindowsBuildResult'
310+
}
311+
312+
bat "copy $WORKSPACE\\libnullpay\\target\\release\\nullpay.dll $WORKSPACE\\cli"
299313

300314
dir('cli') {
301315
bat "sed -i -e \"s/10\\.0\\.0\\.2/${INDY_SDK_SERVER_IP}/g\" docker_pool_transactions_genesis"
302316

317+
def featuresArgs = '--features "nullpay_plugin"'
318+
303319
echo "Windows Indy Cli Test: Build"
304320
withEnv([
305-
"INDY_DIR=$WORKSPACE\\libindy\\prebuilt",
306321
"RUST_BACKTRACE=1"
307322
]) {
308323
bat "cargo build --release"
309324

310325
echo "Windows Indy Cli Test: Build tests"
311-
bat "cargo test --release --no-run"
326+
bat "cargo test --release $featuresArgs --no-run"
312327

313328
echo "Windows Indy Cli Test: Run tests"
314329
withEnv([
315330
"RUST_TEST_THREADS=1",
316-
"RUST_LOG=indy::,zmq=trace",
331+
"RUST_LOG=indy::=debug,zmq=trace",
317332
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
318333
]) {
319-
bat "cargo test --release"
334+
bat "cargo test --release $featuresArgs"
320335
}
321336
}
322337

323338
stash includes: 'target/release/indy-cli.exe,target/release/*.dll', name: 'IndyCliWindowsBuildResult'
324339
}
325340

326-
dir('libnullpay') {
327-
echo "Windows Libnullpay Test: Build"
328-
withEnv([
329-
"INDY_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
330-
"RUST_BACKTRACE=1"
331-
]) {
332-
bat "cargo build --release"
333-
}
334-
335-
stash includes: 'target/release/*.dll', name: 'LibnullpayWindowsBuildResult'
336-
}
337-
338341
//TODO wrappers testing
339342

340343
} finally {

Jenkinsfile.ci

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,43 @@ def windowsTesting() {
5151
echo "Windows Libindy Test: Run tests"
5252
withEnv([
5353
"RUST_TEST_THREADS=1",
54-
"RUST_LOG=indy::,zmq=trace",
54+
"RUST_LOG=indy::=debug,zmq=trace",
5555
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
5656
]) {
5757
bat "cargo test"
5858
}
5959
}
6060
}
6161

62+
dir('libnullpay') {
63+
echo "Windows Libnullpay Test: Build"
64+
withEnv([
65+
"RUST_BACKTRACE=1"
66+
]) {
67+
bat "cargo build"
68+
}
69+
}
70+
71+
bat "copy $WORKSPACE\\libnullpay\\target\\debug\\nullpay.dll $WORKSPACE\\cli"
72+
6273
dir('cli') {
6374
bat "sed -i -e \"s/10\\.0\\.0\\.2/${INDY_SDK_SERVER_IP}/g\" docker_pool_transactions_genesis"
6475

65-
bat "copy $WORKSPACE\\libindy\\target\\debug\\indy.dll $WORKSPACE\\libindy\\prebuilt\\lib"
66-
bat "copy $WORKSPACE\\libindy\\target\\debug\\indy.lib $WORKSPACE\\libindy\\prebuilt\\lib"
76+
def featuresArgs = '--features "nullpay_plugin"'
6777

6878
echo "Windows Indy Cli Test: Build"
6979
withEnv([
70-
"INDY_DIR=$WORKSPACE\\libindy\\prebuilt",
7180
"RUST_BACKTRACE=1"
7281
]) {
73-
bat "cargo test --no-run"
82+
bat "cargo test $featuresArgs --no-run"
7483

7584
echo "Windows Indy Cli Test: Run tests"
7685
withEnv([
7786
"RUST_TEST_THREADS=1",
78-
"RUST_LOG=indy::,zmq=trace",
87+
"RUST_LOG=indy::=debug,zmq=trace",
7988
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
8089
]) {
81-
bat "cargo test"
90+
bat "cargo test $featuresArgs"
8291
}
8392
}
8493
}
@@ -214,10 +223,23 @@ def linuxTesting(file, env_name, network_name) {
214223
sh "cp libindy/target/debug/libindy.so wrappers/java/lib"
215224
sh "cp libindy/target/debug/libindy.so wrappers/python"
216225
sh "cp libindy/target/debug/libindy.so cli"
226+
sh "cp libindy/target/debug/libindy.so libnullpay"
227+
228+
dir('libnullpay') {
229+
echo "${env_name} Libnullpay Test: Build docker image"
230+
231+
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
232+
echo "${env_name} Libnullpay Test: Build"
233+
sh "LIBRARY_PATH=./ cargo build"
234+
}
235+
}
236+
237+
sh "cp libnullpay/target/debug/libnullpay.so cli"
217238

218239
stash includes: 'wrappers/java/lib/libindy.so', name: "LibindyJavaSO${env_name}"
219240
stash includes: 'wrappers/python/libindy.so', name: "LibindyPythonSO${env_name}"
220241
stash includes: 'cli/libindy.so', name: "LibindyCliSO${env_name}"
242+
stash includes: 'cli/libnullpay.so', name: "LibnullpayCliSO${env_name}"
221243

222244
parallel([
223245
"${env_name}-libindy-test": {
@@ -229,7 +251,7 @@ def linuxTesting(file, env_name, network_name) {
229251
sh "RUST_BACKTRACE=1 cargo test --no-run"
230252

231253
echo "${env_name} Libindy Test: Run tests"
232-
sh "RUST_BACKTRACE=1 RUST_LOG=indy::,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test"
254+
sh "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test"
233255
}
234256
}
235257
},
@@ -272,7 +294,7 @@ def linuxJavaTesting(env_name, network_name, testEnv) {
272294
testEnv.inside("--network=${network_name}") {
273295
echo "${env_name} Libindy Test: Test java wrapper"
274296

275-
sh "RUST_LOG=indy::,zmq=trace TEST_POOL_IP=10.0.0.2 mvn clean test"
297+
sh "RUST_LOG=indy::=debug,zmq=trace TEST_POOL_IP=10.0.0.2 mvn clean test"
276298
}
277299
}
278300
}
@@ -285,21 +307,27 @@ def linuxPythonTesting(env_name, network_name, testEnv) {
285307

286308
sh '''
287309
python3.5 -m pip install --user -e .
288-
LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_LOG=indy::,zmq=trace TEST_POOL_IP=10.0.0.2 python3.5 -m pytest
310+
LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_LOG=indy::=debug,zmq=trace TEST_POOL_IP=10.0.0.2 python3.5 -m pytest
289311
'''
290312
}
291313
}
292314
}
293315

294316
def linuxCLITesting(env_name, network_name, testEnv) {
317+
if (env_name == "RedHat"){ // TODO: Delete it IS-702
318+
return;
319+
}
320+
295321
unstash name: "LibindyCliSO${env_name}"
322+
unstash name: "LibnullpayCliSO${env_name}"
323+
296324
dir('cli') {
297325
testEnv.inside("--network=${network_name}") {
298326
echo "${env_name} Indy Cli Test: Build"
299-
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --no-run"
327+
sh 'LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --features "nullpay_plugin" --no-run'
300328

301329
echo "${env_name} Indy Cli Test: Run tests"
302-
sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test'
330+
sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features "nullpay_plugin"'
303331
}
304332
}
305333
}

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
authors = ["Vyacheslav Gudkov <[email protected]>"]
55

66
[features]
7-
payments_cli_tests = []
7+
nullpay_plugin = []
88

99
[dependencies]
1010
ansi_term = "0.10"

cli/build.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,33 @@ use std::fs;
33
use std::path::Path;
44

55
fn main() {
6-
println!("cargo:rustc-link-lib=indy");
7-
86
let target = env::var("TARGET").unwrap();
97
println!("target={}", target);
108

119
if target.find("-windows-").is_some() {
12-
println!("cargo:rustc-link-lib=ssleay32");
13-
println!("cargo:rustc-link-lib=zmq");
14-
println!("cargo:rustc-link-lib=sodium");
10+
println!("cargo:rustc-link-lib=indy.dll");
1511

16-
// TODO: FIXME: Provide more reliable dependencies resolving
12+
let profile = env::var("PROFILE").unwrap();
13+
println!("profile={}", profile);
1714

1815
let output_dir = env::var("OUT_DIR").unwrap();
19-
let prebuilt_dir = env::var("INDY_DIR").unwrap();
16+
println!("output_dir={}", output_dir);
17+
let output_dir = Path::new(output_dir.as_str());
2018

21-
let dst = Path::new(&output_dir[..]).join("..\\..\\..");
22-
let prebuilt_lib = Path::new(&prebuilt_dir[..]).join("lib");
19+
let indy_dir = env::var("INDY_DIR").unwrap_or(format!("..\\libindy\\target\\{}", profile));
20+
println!("indy_dir={}", indy_dir);
21+
let indy_dir = Path::new(indy_dir.as_str());
2322

24-
println!("cargo:rustc-link-search=native={}", prebuilt_dir);
25-
println!("cargo:rustc-flags=-L {}\\lib", prebuilt_dir);
26-
println!("cargo:include={}\\include", prebuilt_dir);
23+
let dst = output_dir.join("..\\..\\..");
24+
println!("cargo:rustc-flags=-L {}", indy_dir.as_os_str().to_str().unwrap());
2725

2826
let files = vec!["indy.dll", "libeay32md.dll", "libsodium.dll", "libzmq.dll", "ssleay32md.dll"];
2927
for f in files.iter() {
30-
if let Ok(_) = fs::copy(&prebuilt_lib.join(f), &dst.join(f)) {
31-
println!("copy {} -> {}", &prebuilt_lib.join(f).display(), &dst.join(f).display());
28+
if let Ok(_) = fs::copy(&indy_dir.join(f), &dst.join(f)) {
29+
println!("copy {} -> {}", &indy_dir.join(f).display(), &dst.join(f).display());
3230
}
3331
}
34-
return;
35-
}
32+
} else {
33+
println!("cargo:rustc-link-lib=indy");
34+
}
3635
}

0 commit comments

Comments
 (0)