Skip to content

Commit 102473e

Browse files
mbwhitejt-nti
authored andcommitted
GHA Workflow
Signed-off-by: Matthew B White <[email protected]>
1 parent c6ff468 commit 102473e

File tree

2 files changed

+149
-4
lines changed

2 files changed

+149
-4
lines changed

.github/workflows/build.yaml

Lines changed: 148 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,153 @@ on:
2020
jobs:
2121
build:
2222
runs-on: ubuntu-latest
23+
24+
strategy:
25+
matrix:
26+
node-version: [16.x]
27+
2328
steps:
24-
- name: placeholder
29+
- uses: actions/checkout@v3
30+
- name: Use Node.js ${{ matrix.node-version }}
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: ${{ matrix.node-version }}
34+
- name: Install/Rebuild/UnitTest
35+
run: |
36+
set -xev
37+
node common/scripts/install-run-rush.js install
38+
node common/scripts/install-run-rush.js rebuild
39+
- name: Pre-process Artifacts
40+
run: |
41+
npx cobertura-merge -o merged_coverage.xml shim=./libraries/fabric-shim/coverage/cobertura-coverage.xml contractapi=./apis/fabric-contract-api/coverage/cobertura-coverage.xml -p
42+
- uses: actions/upload-artifact@v3
43+
name: Upload test results
44+
with:
45+
name: TestResults
46+
path: ./**/test-results.xml
47+
48+
- name: Build Binaries
49+
run: |
50+
set -xev
51+
node common/scripts/install-run-rush.js publish --include-all --pack --release-folder tgz --publish
52+
docker image save hyperledger/fabric-nodeenv | gzip > fabric-nodeenv.tar.gz
53+
54+
- uses: actions/upload-artifact@v3
55+
name: Binaries
56+
with:
57+
name: node-tgzs
58+
path: tgz/
59+
60+
- uses: actions/upload-artifact@v3
61+
name: Docker
62+
with:
63+
name: nodeenv-docker-image
64+
path: fabric-nodeenv.tar.gz
65+
66+
fvtest:
67+
runs-on: ubuntu-latest
68+
needs: build
69+
strategy:
70+
matrix:
71+
node-version: [16.x]
72+
steps:
73+
- uses: actions/checkout@v3
74+
- name: Use Node.js ${{ matrix.node-version }}
75+
uses: actions/setup-node@v3
76+
with:
77+
node-version: ${{ matrix.node-version }}
78+
79+
- uses: actions/download-artifact@v3
80+
with:
81+
name: nodeenv-docker-image
82+
path: build/
83+
- uses: actions/download-artifact@v3
84+
with:
85+
name: node-tgzs
86+
path: build/
87+
88+
- name: Setup the fv build
2589
run: |
26-
ls -lart
27-
echo "Hello!"
90+
set -xev
91+
./tools/getEdgeDocker.sh # essential to get main docker images of peer etc.
92+
docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv
93+
docker tag hyperledger/fabric-nodeenv:latest hyperledger/fabric-nodeenv:2.5
94+
docker images
95+
node common/scripts/install-run-rush.js install
96+
node common/scripts/install-run-rush.js update # should the tests need 'building' this will need to go here
97+
node common/scripts/install-run-rush.js start-fabric
98+
node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
99+
100+
- name: Run the FV Tests
101+
run: |
102+
set -xev
103+
export TLS=true
104+
docker images | grep hyperledger && docker ps -a
105+
106+
node common/scripts/install-run-rush.js test:fv --verbose
107+
node common/scripts/install-run-rush.js test:e2e --verbose
108+
109+
- name: upload results
110+
run: |
111+
set -xev
112+
mkdir -p testlogs
113+
find . \( -type d -name 'node_modules' \) -prune -o -name '*.build*.log' -exec cp {} testlogs \;
114+
115+
- uses: actions/upload-artifact@v3
116+
name: TestLogs
117+
with:
118+
name: TestLogs
119+
path: testlogs\
120+
121+
122+
# Job to handle the auditing of the code
123+
# NPM audit is run on a 'fake' installation of the libraries
124+
# Pulling in all the dependencies it will be able to run NPM AUDIT, and if that returns a
125+
# error code the job will fail.
126+
src_audit:
127+
runs-on: ubuntu-latest
128+
needs: build
129+
strategy:
130+
matrix:
131+
node-version: [16.x]
132+
steps:
133+
- uses: actions/checkout@v3
134+
- name: Use Node.js ${{ matrix.node-version }}
135+
uses: actions/setup-node@v3
136+
with:
137+
node-version: ${{ matrix.node-version }}
138+
- uses: actions/download-artifact@v3
139+
with:
140+
name: node-tgzs
141+
path: build/
142+
- name: run audit
143+
run: |
144+
set -xev -o pipefail
145+
node common/scripts/install-run-rush.js install
146+
node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
147+
mkdir -p audit && cd audit && npm init -y
148+
npm install --registry http://localhost:4873 fabric-shim fabric-shim-api fabric-contract-api --save
149+
npm audit --audit-level=moderate
150+
151+
publish:
152+
runs-on: ubuntu-latest
153+
needs: [build,fvtest,src_audit]
154+
if: startsWith(github.ref, 'refs/tags/')
155+
steps:
156+
- uses: actions/setup-node@v3
157+
with:
158+
node-version: '16.x'
159+
registry-url: 'https://npm.pkg.github.com'
160+
scope: '@mbwhite'
161+
- uses: actions/download-artifact@v3
162+
with:
163+
name: node-tgzs
164+
path: build/
165+
- run: |
166+
set -xev
167+
ls -lart build/
168+
cd build
169+
find . -type f -name 'fabric-*.tgz' -exec npm publish {} \;
170+
env:
171+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172+

test/fv/ledger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const chai = require('chai');
99
chai.use(require('chai-as-promised'));
1010
const expect = chai.expect;
1111
const utils = require('./utils');
12-
const {SHORT_STEP, MED_STEP, LONG_STEP} = utils.TIMEOUTS;
12+
const {LONG_STEP} = utils.TIMEOUTS;
1313

1414
describe('Chaincode ledger', () => {
1515
const suite = 'ledger';

0 commit comments

Comments
 (0)