Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2322 from trufflesuite/fabricEvmJob
Browse files Browse the repository at this point in the history
Internal improvement: Hyperledger `fabric-chaincode-evm` CI job
  • Loading branch information
CruzMolina committed Aug 21, 2019
2 parents 39d0bea + d655c55 commit d8279c9
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ matrix:
env: GETH=true
- node_js: 8
env: QUORUM=true
- node_js: 8
env: FABRICEVM=true
- node_js: 8
env: PACKAGES=true
- node_js: 8
Expand Down
2 changes: 2 additions & 0 deletions packages/truffle/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [ "$GETH" == true ]; then
mocha --timeout 50000 --grep '@ganache|@standalone' --invert --colors $@
elif [ "$QUORUM" == true ]; then
mocha --timeout 50000 --grep @quorum --colors $@
elif [ "$FABRICEVM" == true ]; then
mocha --timeout 50000 --grep @fabric-evm --colors $@
elif [ "$COVERAGE" == true ]; then
NO_BUILD=true mocha --no-warnings --timeout 7000 --grep @geth --invert --colors $@
elif [ "$INTEGRATION" == true ]; then
Expand Down
10 changes: 4 additions & 6 deletions packages/truffle/test/scenarios/migrations/fabric-evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ const { promisify } = require("util");
const RunCommand = promisify(require("../commandrunner").run);
const path = require("path");
const assert = require("assert");
const Server = require("../server");
const Reporter = require("../reporter");
const sandbox = require("../sandbox");
const Web3 = require("web3");

describe("migrate with fabric-evm interface", function() {
describe("migrate with [ @fabric-evm ] interface", function() {
if (!process.env.FABRICEVM) return;
let config;
let web3;
let networkId;
const project = path.join(__dirname, "../../sources/migrations/fabric-evm");
const logger = new MemoryLogger();

before(done => Server.start(done));
after(done => Server.stop(done));

before(async function() {
config = await sandbox.create(project);
config.network = "development";
Expand All @@ -26,11 +23,12 @@ describe("migrate with fabric-evm interface", function() {
reporter: new Reporter(logger)
};

const provider = new Web3.providers.HttpProvider("http://localhost:8545", {
const provider = new Web3.providers.HttpProvider("http://localhost:5000", {
keepAlive: false
});
web3 = new Web3(provider);
networkId = await web3.eth.net.getId();
networkId = web3.utils.numberToHex(networkId).replace("0x", "");
});

it("runs migrations (sync & async/await)", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545,
port: 5000,
network_id: "*",
gas: 4700000,
gasPrice: 20000000000,
type: "fabric-evm"
}
}
Expand Down
29 changes: 29 additions & 0 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,35 @@ elif [ "$QUORUM" = true ]; then
sleep 90
lerna run --scope truffle test --stream -- --exit

elif [ "$FABRICEVM" = true ]; then

root=$(pwd)
sudo add-apt-repository -y ppa:rmescandon/yq
sudo apt update
sudo apt install -y yq
cd $GOPATH
mkdir -p src/github.com/hyperledger
cd src/github.com/hyperledger
git clone https://github.com/hyperledger/fabric-chaincode-evm
curl -sSL http://bit.ly/2ysbOFE | bash -s 1.4.1
cd fabric-samples/first-network
yq w -i docker-compose-cli.yaml "services.cli.volumes[+]" "./../../fabric-chaincode-evm:/opt/gopath/src/github.com/hyperledger/fabric-chaincode-evm"
yes Y | ./byfn.sh up
docker exec -it cli sh -c "peer chaincode install -n evmcc -l golang -v 0 -p github.com/hyperledger/fabric-chaincode-evm/evmcc &&
peer chaincode instantiate -n evmcc -v 0 -C mychannel -c '{\"Args\":[]}' -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
cd ../../fabric-chaincode-evm
make fab3
# Environment Variables for Fab3:
export FAB3_CONFIG=${GOPATH}/src/github.com/hyperledger/fabric-chaincode-evm/examples/first-network-sdk-config.yaml
export FAB3_USER=User1
export FAB3_ORG=Org1
export FAB3_CHANNEL=mychannel
export FAB3_CCID=evmcc
export FAB3_PORT=5000
bin/fab3 &>/dev/null &
cd $root
lerna run --scope truffle test --stream -- --exit

elif [ "$PACKAGES" = true ]; then

docker pull ethereum/solc:0.4.22
Expand Down

0 comments on commit d8279c9

Please sign in to comment.