Skip to content

Commit

Permalink
feat: Add corda to CI (#84)
Browse files Browse the repository at this point in the history
* feature: add all scenarios to ci.sh, but travis runs only subset of them

Signed-off-by: Denis Glotov <denis.glotov@accenture.com>

* fix: disable circle-ci Fabric deploy because Corda fills vm all resources and

crashes if more processes comes in.
`resource_class: large` would probably help so revert this patch when we have
it available.

Signed-off-by: Denis Glotov <denis.glotov@accenture.com>

* feature: add circle-ci badge to readme

Signed-off-by: Denis Glotov <denis.glotov@accenture.com>
  • Loading branch information
denis-yu-glotov authored and petermetz committed Jan 6, 2020
1 parent 48d2536 commit bd796d6
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 57 deletions.
58 changes: 29 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
# GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
machine:
image: ubuntu-1604:201903-01
resource_class: large
# resource_class: large
steps:
- checkout # check out source code to working directory
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
Expand Down Expand Up @@ -46,43 +46,43 @@ jobs:
command: |
cd packages/core/examples/simple-asset-transfer/
npm run corda
- run:
name: Starting Fabric
command: |
source /opt/circleci/.nvm/nvm.sh
cd packages/core/examples/simple-asset-transfer/
npm install
cd ./fabric/api/
npm install
cd ../../
npm run fabric
# - run:
# name: Starting Fabric
# command: |
# source /opt/circleci/.nvm/nvm.sh
# cd packages/core/examples/simple-asset-transfer/
# npm install
# cd ./fabric/api/
# npm install
# cd ../../
# npm run fabric

- run:
name: Build and federation networks
command: |
source /opt/circleci/.nvm/nvm.sh
cd packages/core/examples/simple-asset-transfer/
npm run fed:build
npm run fed:corda
npm run fed:fabric
# - run:
# name: Build and federation networks
# command: |
# source /opt/circleci/.nvm/nvm.sh
# cd packages/core/examples/simple-asset-transfer/
# npm run fed:build
# npm run fed:corda
# npm run fed:fabric

- run:
name: Run scenarios
command: |
source /opt/circleci/.nvm/nvm.sh
cd packages/core/examples/simple-asset-transfer/
npm run scenario:share noquorum
npm run scenario:CtF
npm run scenario:FtC
# - run:
# name: Run scenarios
# command: |
# source /opt/circleci/.nvm/nvm.sh
# cd packages/core/examples/simple-asset-transfer/
# npm run scenario:share noquorum
# npm run scenario:CtF
# npm run scenario:FtC

- run:
name: Stopping Corda
command: |
cd packages/core/examples/simple-asset-transfer/
npm run fed:corda:down
npm run fed:fabric:down
# npm run fed:fabric:down
npm run corda:down
npm run fabric:down
# npm run fabric:down
# Upload test results for display in Test Summary:
# https://circleci.com/docs/2.0/collect-test-data/
Expand Down
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ dist: bionic
services:
- docker

install:
- docker --version
- docker-compose --version

script:
- ./packages/core/tools/ci.sh
- CI_CONTAINERS_WAIT_TIME=12 CI_NO_CORDA=true ./packages/core/tools/ci.sh

after_script:
- docker ps -a
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Hyperledger Labs Blockchain Integration Framework <!-- omit in toc -->

[![Build status]](https://travis-ci.org/hyperledger-labs/blockchain-integration-framework)
[![CircleCI]](https://circleci.com/gh/hyperledger-labs/blockchain-integration-framework/tree/master)

[Build status]: https://travis-ci.org/hyperledger-labs/blockchain-integration-framework.svg?branch=master
[CircleCI]: https://circleci.com/gh/hyperledger-labs/blockchain-integration-framework/tree/master.svg?style=svg

- [Short Description](#short-description)
- [Scope of Lab](#scope-of-lab)
Expand Down
34 changes: 24 additions & 10 deletions packages/core/tools/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function mainTask()
docker-compose --version
node --version
npm --version
java -version || true
java -version

### COMMON
cd $PKG_ROOT_DIR
Expand All @@ -47,6 +47,7 @@ function mainTask()
cd $CI_ROOT_DIR
npm run fed:quorum:down
npm run fed:fabric:down
npm run fed:corda:down
npm run fabric:down
npm run quorum:down
npm run quorum:api:down
Expand All @@ -58,10 +59,9 @@ function mainTask()
npm uninstall @hyperledger-labs/blockchain-integration-framework
npm install @hyperledger-labs/blockchain-integration-framework@file:../../.tmp/hyperledger-labs-blockchain-integration-framework-dev.tgz

rm -rf fabric/api/fabric-client-kv-org*

### FABRIC

rm -rf fabric/api/fabric-client-kv-org*
cd ./fabric/api/
npm install
cd ../../
Expand All @@ -82,7 +82,6 @@ function mainTask()
npm run fed:build
npm run fed:quorum
npm run fed:fabric
docker images

# If enough time have passed and there are still containers not ready then
# just assume that they are in a crash loop and abort CI run.
Expand All @@ -94,23 +93,38 @@ function mainTask()
iterationCount=$[$iterationCount +1]
sleep 15; echo; date;
done

docker ps -a
sleep ${CI_CONTAINERS_WAIT_TIME:-120}

# Run scenarios and blockchain regression tests
npm run scenario:share nocorda
if [ -v CI_NO_CORDA ]; then
npm run scenario:share nocorda
else
npm run corda:build
npm run corda
npm run fed:corda
sleep ${CI_CONTAINERS_WAIT_TIME:-12}

# Run scenarios between Corda and Quorum
npm run scenario:share
npm run scenario:CtF
npm run scenario:FtC
npm run scenario:CtQ
npm run scenario:QtC
fi
npm run scenario:QtF
npm run scenario:FtQ
npm run test:bc

dumpAllLogs

# Unloading Quorum staff to save resources for Corda
npm run fed:quorum:down
npm run fed:corda:down
npm run fed:fabric:down
npm run fabric:down
npm run quorum:down
npm run corda:down
npm run quorum:api:down
npm run quorum:down
npm run fabric:down
cd ../..

ENDED_AT=`date +%s`
Expand All @@ -136,7 +150,7 @@ function dumpAllLogs()
set +eu # do not crash process upon individual command failures
cd "$PKG_ROOT_DIR" # switch back to the original root dir because we don't
# know where exactly the script crashed
[ "$CI_NO_DUMP_ALL_LOGS" ] || ./tools/dump-all-logs.sh $CI_ROOT_DIR
[ -v CI_NO_DUMP_ALL_LOGS ] || ./tools/dump-all-logs.sh $CI_ROOT_DIR
cd -
}

Expand Down
13 changes: 0 additions & 13 deletions packages/core/tools/cleanup.sh

This file was deleted.

0 comments on commit bd796d6

Please sign in to comment.