Skip to content

carbon accounting trivy scan #104

carbon accounting trivy scan

carbon accounting trivy scan #104

# 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/[email protected]
with:
go-version: '1.20.2'
- name: Use Node.js 14.x
uses: actions/[email protected]
with:
node-version: 14.x
# FABRIC NETWORK
- name: Start Fabric Network
run: make start-interop CHAINCODE_NAME=simpleasset PROFILE="2-nodes"
working-directory: weaver/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: weaver/samples/fabric/fabric-cli
- name: Build Fabric CLI
run: npm install
working-directory: weaver/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}/weaver#g" config.json
working-directory: weaver/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}/weaver/samples/fabric/fabric-cli/src/data/credentials_docker
./bin/fabric-cli env set CONFIG_PATH ${GITHUB_WORKSPACE}/weaver/samples/fabric/fabric-cli/config.json
cat .env
working-directory: weaver/samples/fabric/fabric-cli
- name: Fabric CLI Init
run: ./scripts/initAsset.sh
working-directory: weaver/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: weaver/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/[email protected]
with:
go-version: '1.20.2'
- name: Use Node.js 14.x
uses: actions/[email protected]
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: weaver/common/protos-js
# Build Dependencies
- name: Build Fabric Interop SDK
run: make build-local
working-directory: weaver/sdks/fabric/interoperation-node-sdk
- name: Build Fabric CLI
run: make build-local
working-directory: weaver/samples/fabric/fabric-cli
# FABRIC NETWORK
- name: Start Fabric Network
run: make start-interop-local CHAINCODE_NAME=simpleasset
working-directory: weaver/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}/weaver#g" config.json
working-directory: weaver/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}/weaver/samples/fabric/fabric-cli/src/data/credentials_docker
./bin/fabric-cli env set CONFIG_PATH ${GITHUB_WORKSPACE}/weaver/samples/fabric/fabric-cli/config.json
cat .env
working-directory: weaver/samples/fabric/fabric-cli
- name: Fabric CLI Init
run: ./scripts/initAsset.sh
working-directory: weaver/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: weaver/samples/fabric/fabric-cli