move builds to newer versions #148
Workflow file for this run
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
name: Test Chaincodes and Benchmarks | |
on: | |
pull_request: | |
branches: [ main ] | |
env: | |
FABRIC_VERSION: 2.5.7 | |
CALIPER_VERSION: 0.6.0 | |
FABRIC_BIND_SUT: fabric-gateway | |
jobs: | |
changes: | |
name: Check for changes | |
runs-on: ubuntu-latest | |
outputs: | |
benchmark: ${{ steps.benchmarks-filter.outputs.changes }} | |
cc-env: ${{ steps.cc-env-filter.outputs.changes }} | |
steps: | |
- uses: dorny/[email protected] | |
name: Check for changes in benchmarks | |
id: benchmarks-filter | |
with: | |
filters: | | |
fabcar: | |
- 'benchmarks/samples/fabric/fabcar/**' | |
- 'src/fabric/samples/fabcar/**' | |
- 'networks/fabric/**' | |
- '.github/**' | |
marbles: | |
- 'benchmarks/samples/fabric/marbles/**' | |
- 'src/fabric/samples/marbles/**' | |
- 'src/fabric/samples/marbles-norichquery/**' | |
- 'networks/fabric/**' | |
- '.github/**' | |
simple: | |
- 'benchmarks/scenario/simple/**' | |
- 'src/fabric/scenario/simple/**' | |
- 'networks/fabric/**' | |
- '.github/**' | |
smallbank: | |
- 'benchmarks/scenario/smallbank/**' | |
- 'src/fabric/scenario/smallbank/**' | |
- 'networks/fabric/**' | |
- '.github/**' | |
fixed-asset: | |
- 'benchmarks/api/fabric/**' | |
- 'src/fabric/api/fixed-asset/**' | |
- 'src/fabric/api/fixed-asset-base/**' | |
- 'networks/fabric/**' | |
- 'networks/prometheus-grafana/**' | |
- '.github/**' | |
- uses: dorny/[email protected] | |
name: Check for changes in chaincode environments | |
id: cc-env-filter | |
with: | |
filters: | | |
go: | |
- 'src/fabric/**/go/**' | |
- 'networks/fabric/**' | |
- 'benchmarks/**/fabric/**' | |
- 'benchmarks/scenario/**' | |
- '.github/**' | |
node: | |
- 'src/fabric/**/node/**' | |
- 'networks/fabric/**' | |
- 'benchmarks/**/fabric/**' | |
- 'benchmarks/scenario/**' | |
- '.github/**' | |
java: | |
- 'src/fabric/**/java/**' | |
- 'networks/fabric/**' | |
- 'benchmarks/**/fabric/**' | |
- 'benchmarks/scenario/**' | |
- '.github/**' | |
populate-cache: | |
needs: changes | |
if: > | |
needs.changes.outputs.benchmark != '[]' && | |
needs.changes.outputs.benchmark != '' && | |
needs.changes.outputs.cc-env != '[]' && | |
needs.changes.outputs.cc-env != '' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/[email protected] | |
with: | |
path: node_modules | |
key: ${{ matrix.node-version }}-npm-cache-${{ env.CALIPER_VERSION }}-${{ env.FABRIC_BIND_SUT }} | |
restore-keys: | | |
${{ matrix.node-version }}-npm-cache- | |
- name: Install Caliper and bind to Fabric | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: | | |
npm install --only=prod @hyperledger/caliper-cli@${{ env.CALIPER_VERSION }} | |
npx caliper bind --caliper-bind-sut fabric:${{ env.FABRIC_BIND_SUT }} | |
npx caliper --version | |
- name: Cache Fabric Samples and Binaries | |
id: cache-fabric | |
uses: actions/[email protected] | |
with: | |
path: fabric-samples | |
key: ${{ runner.os }}-fabric-samples-${{ env.FABRIC_VERSION }} | |
- name: Download Fabric Samples | |
if: steps.cache-fabric.outputs.cache-hit != 'true' | |
run: curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- ${{ env.FABRIC_VERSION }} -d | |
build: | |
needs: | |
- populate-cache | |
- changes | |
if: > | |
needs.changes.outputs.benchmark != '[]' && | |
needs.changes.outputs.benchmark != '' && | |
needs.changes.outputs.cc-env != '[]' && | |
needs.changes.outputs.cc-env != '' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
cc-env: ${{ fromJSON(needs.changes.outputs.cc-env) }} | |
benchmark: ${{ fromJSON(needs.changes.outputs.benchmark) }} | |
exclude: | |
- cc-env: java | |
benchmark: marbles | |
- cc-env: java | |
benchmark: simple | |
- cc-env: node | |
benchmark: smallbank | |
- cc-env: java | |
benchmark: smallbank | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version: 20.x | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/[email protected] | |
with: | |
path: node_modules | |
key: ${{ matrix.node-version }}-npm-cache-${{ env.CALIPER_VERSION }}-${{ env.FABRIC_BIND_SUT }} | |
restore-keys: | | |
${{ matrix.node-version }}-npm-cache- | |
- name: Cache Fabric Samples and Binaries | |
id: cache-fabric | |
uses: actions/[email protected] | |
with: | |
path: fabric-samples | |
key: ${{ runner.os }}-fabric-samples-${{ env.FABRIC_VERSION }} | |
- name: Copy Fabric Samples to correct path | |
run: cp -r fabric-samples ../ | |
- name: Pull Fabric images | |
run: curl -sSL -k https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- ${{ env.FABRIC_VERSION }} -s -b | |
- name: Start Fabric Network | |
working-directory: ../fabric-samples/test-network | |
run: ./network.sh up createChannel -s couchdb | |
- name: Start Prometheus and Grafana | |
working-directory: ../fabric-samples/test-network/prometheus-grafana | |
run: docker-compose up -d | |
- name: Deploy Chaincode | |
working-directory: ../fabric-samples/test-network | |
run: ../../caliper-benchmarks/.github/scripts/deploy-chaincode.sh ${{ matrix.cc-env }} ${{ matrix.benchmark }} | |
- name: Run Caliper Benchmark | |
run: .github/scripts/run-benchmark.sh ${{ matrix.benchmark }} |