Fixed build errors, added protos-rs publish action, updated tutorial instructions #777
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright IBM Corp. All Rights Reserved. | |
# | |
# SPDX-License-Identifier: CC-BY-4.0 | |
# This is a basic workflow to help you get started with Actions | |
name: Test Asset Exchange Fabric | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
asset-exchange-fabric: | |
# if: ${{ false }} | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/[email protected] | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20.2' | |
- name: Use Node.js 14.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14.x | |
# FABRIC NETWORK | |
- name: Start Fabric Network | |
run: make start-interop CHAINCODE_NAME=simpleasset PROFILE="2-nodes" | |
working-directory: tests/network-setups/fabric/dev | |
# FABRIC CLI | |
- name: Setup Fabric CLI .npmrc | |
run: | | |
cp .npmrc.template .npmrc | |
sed -i "s/<personal-access-token>/${{ secrets.GITHUB_TOKEN }}/g" .npmrc | |
cat .npmrc | |
working-directory: samples/fabric/fabric-cli | |
- name: Build Fabric CLI | |
run: npm install | |
working-directory: samples/fabric/fabric-cli | |
- name: Setup Fabric CLI Config | |
run: | | |
echo ${GITHUB_WORKSPACE} | |
cp config.template.json config.json | |
sed -i "s#<PATH-TO-WEAVER>#${GITHUB_WORKSPACE}#g" config.json | |
working-directory: samples/fabric/fabric-cli | |
- name: Setup Fabric CLI ENV | |
run: | | |
echo ${GITHUB_WORKSPACE} | |
cp .env.template .env | |
./bin/fabric-cli env set MEMBER_CREDENTIAL_FOLDER ${GITHUB_WORKSPACE}/samples/fabric/fabric-cli/src/data/credentials_docker | |
./bin/fabric-cli env set CONFIG_PATH ${GITHUB_WORKSPACE}/samples/fabric/fabric-cli/config.json | |
cat .env | |
working-directory: samples/fabric/fabric-cli | |
- name: Fabric CLI Init | |
run: ./scripts/initAsset.sh | |
working-directory: samples/fabric/fabric-cli | |
- name: Asset Exchange Fabric CLI Tests | |
run: | | |
COUNT=0 | |
TOTAL=1 | |
# FABRIC2 - FABRIC1 | |
./bin/fabric-cli asset exchange-all --network1=network1 --network2=network2 --secret=secrettext --timeout-duration=100 bob:bond01:a04:alice:token1:100 &> tmp.out | |
tail -n 2 tmp.out | grep "Asset Exchange Complete." && COUNT=$(( COUNT + 1 )) && echo "PASS" | |
cat tmp.out | |
# RESULT | |
echo "Passed $COUNT/$TOTAL Tests." | |
if [ $COUNT == $TOTAL ]; then | |
exit 0 | |
else | |
exit 1 | |
fi | |
working-directory: samples/fabric/fabric-cli | |
asset-exchange-fabric-local: | |
# if: ${{ false }} | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/[email protected] | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20.2' | |
- name: Use Node.js 14.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14.x | |
- name: Use Protoc 3.15 | |
run: | | |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip | |
unzip protoc-3.15.6-linux-x86_64.zip -d protoc | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | |
# PROTOS | |
- name: Build JS Protos | |
run: | | |
export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin" | |
make build | |
working-directory: common/protos-js | |
# Build Dependencies | |
- name: Build Fabric Interop SDK | |
run: make build-local | |
working-directory: sdks/fabric/interoperation-node-sdk | |
- name: Build Fabric CLI | |
run: make build-local | |
working-directory: samples/fabric/fabric-cli | |
# FABRIC NETWORK | |
- name: Start Fabric Network | |
run: make start-interop-local CHAINCODE_NAME=simpleasset | |
working-directory: tests/network-setups/fabric/dev | |
# FABRIC CLI | |
- name: Setup Fabric CLI Config | |
run: | | |
echo ${GITHUB_WORKSPACE} | |
cp config.template.json config.json | |
sed -i "s#<PATH-TO-WEAVER>#${GITHUB_WORKSPACE}#g" config.json | |
working-directory: samples/fabric/fabric-cli | |
- name: Setup Fabric CLI ENV | |
run: | | |
echo ${GITHUB_WORKSPACE} | |
cp .env.template .env | |
./bin/fabric-cli env set MEMBER_CREDENTIAL_FOLDER ${GITHUB_WORKSPACE}/samples/fabric/fabric-cli/src/data/credentials_docker | |
./bin/fabric-cli env set CONFIG_PATH ${GITHUB_WORKSPACE}/samples/fabric/fabric-cli/config.json | |
cat .env | |
working-directory: samples/fabric/fabric-cli | |
- name: Fabric CLI Init | |
run: ./scripts/initAsset.sh | |
working-directory: samples/fabric/fabric-cli | |
- name: Asset Exchange Fabric CLI Tests | |
run: | | |
COUNT=0 | |
TOTAL=1 | |
# FABRIC2 - FABRIC1 | |
./bin/fabric-cli asset exchange-all --network1=network1 --network2=network2 --secret=secrettext --timeout-duration=100 bob:bond01:a04:alice:token1:100 &> tmp.out | |
tail -n 2 tmp.out | grep "Asset Exchange Complete." && COUNT=$(( COUNT + 1 )) && echo "PASS" | |
cat tmp.out | |
# RESULT | |
echo "Passed $COUNT/$TOTAL Tests." | |
if [ $COUNT == $TOTAL ]; then | |
exit 0 | |
else | |
exit 1 | |
fi | |
working-directory: samples/fabric/fabric-cli |