Skip to content

Instantly share code, notes, and snippets.

@javaguirre
Last active February 21, 2019 11:16
Show Gist options
  • Save javaguirre/160428b1ba46b5ba5e4e8cb8a587fd21 to your computer and use it in GitHub Desktop.
Save javaguirre/160428b1ba46b5ba5e4e8cb8a587fd21 to your computer and use it in GitHub Desktop.
Test stage for Hyperledger Fabric
test:
  stage: test
  image: golang:1.10
  script:
  # Go dependencies for Hyperledger Fabric Go SDK and testing with elegance
- go get -v -u github.com/hyperledger/fabric-sdk-go
  - go get -v -u github.com/stretchr/testify/assert
# Copy chaincode to the $GOPATH
  - mkdir -p $GOPATH/src/gitlab.com/myproject/ngo
  - cp -r /builds/myproject/myrepository/chaincode/chaincode_name/* $GOPATH/src/gitlab.com/myproject/chaincode_name
  # Build hyperledger fabric
# Install OS dependencies
  - apt-get update && apt-get install -y libltdl-dev
# Create Hyperledger Fabric module in the $GOPATH
  - mkdir -p $GOPATH/src/github.com/hyperledger
  - cd $GOPATH/src/github.com/hyperledger
  - git clone -b master https://github.com/hyperledger/fabric.git
# Run the tests in our chaincode folder
  - cd $GOPATH/src/gitlab.com/myproject/chaincode_name
  - go test -v .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment