Skip to content

Commit

Permalink
GHA Workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew B White <[email protected]>
  • Loading branch information
mbwhite authored and jt-nti committed Dec 16, 2022
1 parent c6ff468 commit 102473e
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 4 deletions.
151 changes: 148 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,153 @@ on:
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- name: placeholder
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install/Rebuild/UnitTest
run: |
set -xev
node common/scripts/install-run-rush.js install
node common/scripts/install-run-rush.js rebuild
- name: Pre-process Artifacts
run: |
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
- uses: actions/upload-artifact@v3
name: Upload test results
with:
name: TestResults
path: ./**/test-results.xml

- name: Build Binaries
run: |
set -xev
node common/scripts/install-run-rush.js publish --include-all --pack --release-folder tgz --publish
docker image save hyperledger/fabric-nodeenv | gzip > fabric-nodeenv.tar.gz
- uses: actions/upload-artifact@v3
name: Binaries
with:
name: node-tgzs
path: tgz/

- uses: actions/upload-artifact@v3
name: Docker
with:
name: nodeenv-docker-image
path: fabric-nodeenv.tar.gz

fvtest:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- uses: actions/download-artifact@v3
with:
name: nodeenv-docker-image
path: build/
- uses: actions/download-artifact@v3
with:
name: node-tgzs
path: build/

- name: Setup the fv build
run: |
ls -lart
echo "Hello!"
set -xev
./tools/getEdgeDocker.sh # essential to get main docker images of peer etc.
docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv
docker tag hyperledger/fabric-nodeenv:latest hyperledger/fabric-nodeenv:2.5
docker images
node common/scripts/install-run-rush.js install
node common/scripts/install-run-rush.js update # should the tests need 'building' this will need to go here
node common/scripts/install-run-rush.js start-fabric
node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
- name: Run the FV Tests
run: |
set -xev
export TLS=true
docker images | grep hyperledger && docker ps -a
node common/scripts/install-run-rush.js test:fv --verbose
node common/scripts/install-run-rush.js test:e2e --verbose
- name: upload results
run: |
set -xev
mkdir -p testlogs
find . \( -type d -name 'node_modules' \) -prune -o -name '*.build*.log' -exec cp {} testlogs \;
- uses: actions/upload-artifact@v3
name: TestLogs
with:
name: TestLogs
path: testlogs\


# Job to handle the auditing of the code
# NPM audit is run on a 'fake' installation of the libraries
# Pulling in all the dependencies it will be able to run NPM AUDIT, and if that returns a
# error code the job will fail.
src_audit:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/download-artifact@v3
with:
name: node-tgzs
path: build/
- name: run audit
run: |
set -xev -o pipefail
node common/scripts/install-run-rush.js install
node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
mkdir -p audit && cd audit && npm init -y
npm install --registry http://localhost:4873 fabric-shim fabric-shim-api fabric-contract-api --save
npm audit --audit-level=moderate
publish:
runs-on: ubuntu-latest
needs: [build,fvtest,src_audit]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@mbwhite'
- uses: actions/download-artifact@v3
with:
name: node-tgzs
path: build/
- run: |
set -xev
ls -lart build/
cd build
find . -type f -name 'fabric-*.tgz' -exec npm publish {} \;
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion test/fv/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const chai = require('chai');
chai.use(require('chai-as-promised'));
const expect = chai.expect;
const utils = require('./utils');
const {SHORT_STEP, MED_STEP, LONG_STEP} = utils.TIMEOUTS;
const {LONG_STEP} = utils.TIMEOUTS;

describe('Chaincode ledger', () => {
const suite = 'ledger';
Expand Down

0 comments on commit 102473e

Please sign in to comment.