From b51445d6c15639c821e0fc128befd169c0c44c91 Mon Sep 17 00:00:00 2001 From: CaptainIRS <36656347+CaptainIRS@users.noreply.github.com> Date: Thu, 4 Aug 2022 18:21:57 +0530 Subject: [PATCH] Add coverage report workflow Signed-off-by: CaptainIRS <36656347+CaptainIRS@users.noreply.github.com> --- .github/workflows/coverage.yml | 24 +++++++++++++++++++++ .github/workflows/pr.yml | 3 +++ .github/workflows/unit-tests.yml | 6 ++++++ packages/caliper-cli/package.json | 4 ++-- packages/caliper-core/package.json | 2 +- packages/caliper-ethereum/package.json | 4 ++-- packages/caliper-fabric/package.json | 2 +- packages/caliper-fisco-bcos/package.json | 4 ++-- packages/caliper-gui-dashboard/package.json | 2 +- packages/caliper-gui-server/package.json | 4 ++-- packages/caliper-publish/package.json | 4 ++-- packages/generator-caliper/package.json | 4 ++-- 12 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000000..65a50888c7 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -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] + 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/codecov-action@v3.1.0 + with: + files: packages/${{ matrix.package }}/coverage/clover.xml + flags: ${{ matrix.package }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9f3d12d1e4..35b77add13 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -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 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 574960f368..81cd0dfdf9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -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 diff --git a/packages/caliper-cli/package.json b/packages/caliper-cli/package.json index 858251405b..06f946da76 100644 --- a/packages/caliper-cli/package.json +++ b/packages/caliper-cli/package.json @@ -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", @@ -89,4 +89,4 @@ "lines": 5 }, "license": "Apache-2.0" -} \ No newline at end of file +} diff --git a/packages/caliper-core/package.json b/packages/caliper-core/package.json index 94d208d970..dc5914a15f 100644 --- a/packages/caliper-core/package.json +++ b/packages/caliper-core/package.json @@ -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", diff --git a/packages/caliper-ethereum/package.json b/packages/caliper-ethereum/package.json index 2d0dbcb3af..b40e467c59 100644 --- a/packages/caliper-ethereum/package.json +++ b/packages/caliper-ethereum/package.json @@ -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", @@ -83,4 +83,4 @@ "lines": 5 }, "license": "Apache-2.0" -} \ No newline at end of file +} diff --git a/packages/caliper-fabric/package.json b/packages/caliper-fabric/package.json index e120d7a16a..caa0ecd030 100644 --- a/packages/caliper-fabric/package.json +++ b/packages/caliper-fabric/package.json @@ -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", diff --git a/packages/caliper-fisco-bcos/package.json b/packages/caliper-fisco-bcos/package.json index ff0e7df94b..fc0be9d826 100644 --- a/packages/caliper-fisco-bcos/package.json +++ b/packages/caliper-fisco-bcos/package.json @@ -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", @@ -86,4 +86,4 @@ "lines": 5 }, "license": "Apache-2.0" -} \ No newline at end of file +} diff --git a/packages/caliper-gui-dashboard/package.json b/packages/caliper-gui-dashboard/package.json index 12b1d4b8e3..4cc4d1bf94 100755 --- a/packages/caliper-gui-dashboard/package.json +++ b/packages/caliper-gui-dashboard/package.json @@ -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", diff --git a/packages/caliper-gui-server/package.json b/packages/caliper-gui-server/package.json index d1285e3154..dcf873d1a8 100644 --- a/packages/caliper-gui-server/package.json +++ b/packages/caliper-gui-server/package.json @@ -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": { @@ -98,4 +98,4 @@ "lines": 1 }, "license": "Apache-2.0" -} \ No newline at end of file +} diff --git a/packages/caliper-publish/package.json b/packages/caliper-publish/package.json index b7be09fdf4..8acec228c9 100644 --- a/packages/caliper-publish/package.json +++ b/packages/caliper-publish/package.json @@ -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", @@ -82,4 +82,4 @@ "lines": 5 }, "license": "Apache-2.0" -} \ No newline at end of file +} diff --git a/packages/generator-caliper/package.json b/packages/generator-caliper/package.json index 8ecd16d890..8dc6401825 100644 --- a/packages/generator-caliper/package.json +++ b/packages/generator-caliper/package.json @@ -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", @@ -92,4 +92,4 @@ "functions": 1, "lines": 1 } -} \ No newline at end of file +}