Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage report workflow #1428

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Coverage Reports

on:
workflow_call:

jobs:
coverage:
name: Coverage Reports
runs-on: ubuntu-latest
strategy:
matrix:
package: [caliper-core, caliper-fabric, generator-caliper]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not want all the other packages ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because we're running unit tests only for these packages (since only these packages have unit tests). Most other packages simply run the linter when npm test is run, so we wouldn't have coverage information.

steps:
- uses: actions/checkout@v3
- name: Download coverage reports artifact
uses: actions/download-artifact@v1
with:
name: coverage-reports
path: packages
- name: Upload coverage reports
uses: codecov/[email protected]
with:
files: packages/${{ matrix.package }}/coverage/clover.xml
flags: ${{ matrix.package }}
3 changes: 3 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
unit-tests:
uses: ./.github/workflows/unit-tests.yml
needs: dci-lint
coverage:
uses: ./.github/workflows/coverage.yml
needs: unit-tests
integration-tests:
uses: ./.github/workflows/integration-tests.yml
needs: unit-tests
6 changes: 6 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ jobs:
run: ./packages/caliper-publish/publish.js version check
- name: Run unit tests
run: npm test --workspaces
- name: Upload coverage reports artifact
if: matrix.node-version == '16.x'
uses: actions/upload-artifact@v3
with:
name: coverage-reports
path: packages/*/coverage/clover.xml
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ![Hyperledger Caliper](https://wiki.hyperledger.org/download/attachments/2392434/Hyperledger_Caliper_Logo_Color.svg?version=1&modificationDate=1548883186000&api=v2)

[![CI](https://github.com/hyperledger/caliper/actions/workflows/main.yml/badge.svg)](https://github.com/hyperledger/caliper/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/hyperledger/caliper/branch/main/graph/badge.svg?token=rVFhTNrZBJ)](https://codecov.io/gh/hyperledger/caliper)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2381/badge)](https://bestpractices.coreinfrastructure.org/projects/2381)
[![license](https://img.shields.io/badge/license-Apache%202.0-blue)](https://github.com/hyperledger/caliper/blob/main/LICENSE)
[![node (scoped)](https://img.shields.io/node/v/@hyperledger/caliper-cli)](https://www.npmjs.com/package/@hyperledger/caliper-cli)
Expand Down
4 changes: 2 additions & 2 deletions packages/caliper-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000"
},
"engines": {
"node": ">=14.19.0",
Expand Down Expand Up @@ -89,4 +89,4 @@
"lines": 5
},
"license": "Apache-2.0"
}
}
2 changes: 1 addition & 1 deletion packages/caliper-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint && npm run nyc",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000"
},
"engines": {
"node": ">=14.19.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/caliper-ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000"
},
"engines": {
"node": ">=14.19.0",
Expand Down Expand Up @@ -83,4 +83,4 @@
"lines": 5
},
"license": "Apache-2.0"
}
}
2 changes: 1 addition & 1 deletion packages/caliper-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint && npm run nyc",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000"
},
"engines": {
"node": ">=14.19.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/caliper-fisco-bcos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000"
},
"engines": {
"node": ">=14.19.0",
Expand Down Expand Up @@ -86,4 +86,4 @@
"lines": 5
},
"license": "Apache-2.0"
}
}
2 changes: 1 addition & 1 deletion packages/caliper-gui-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000",
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000",
"start": "SKIP_PREFLIGHT_CHECK=true react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
Expand Down
4 changes: 2 additions & 2 deletions packages/caliper-gui-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000",
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000",
"start": "node app.js"
},
"engines": {
Expand Down Expand Up @@ -98,4 +98,4 @@
"lines": 1
},
"license": "Apache-2.0"
}
}
4 changes: 2 additions & 2 deletions packages/caliper-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000"
},
"engines": {
"node": ">=14.19.0",
Expand Down Expand Up @@ -82,4 +82,4 @@
"lines": 5
},
"license": "Apache-2.0"
}
}
4 changes: 2 additions & 2 deletions packages/generator-caliper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"licchk": "license-check-and-add",
"test": "npm run lint && npm run nyc",
"lint": "npx eslint .",
"nyc": "nyc mocha --recursive -t 10000"
"nyc": "nyc --reporter=text --reporter=clover mocha --recursive -t 10000"
},
"engines": {
"node": ">=14.19.0",
Expand Down Expand Up @@ -92,4 +92,4 @@
"functions": 1,
"lines": 1
}
}
}