-
Notifications
You must be signed in to change notification settings - Fork 119
164 lines (161 loc) · 5.66 KB
/
fabric-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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/paths-filter@v3.0.2
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/paths-filter@v3.0.2
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/cache@v4.0.2
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/cache@v4.0.2
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/checkout@v4.1.4
- uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
- name: Cache node modules
id: cache-npm
uses: actions/cache@v4.0.2
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/cache@v4.0.2
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 }}