diff --git a/.github/workflows/code-coverage.yaml b/.github/workflows/code-coverage.yaml new file mode 100644 index 00000000000..7e1c836f6b9 --- /dev/null +++ b/.github/workflows/code-coverage.yaml @@ -0,0 +1,99 @@ +name: code-coverage + +on: + push: + # Publish `main` as Docker `latest` image. + branches: + - code-coverage + + # Publish `v1.2.3` tags as releases. + tags: + - v* +env: + NODEJS_VERSION: v18.18.2 +jobs: + run_tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install istanbul-merge + run: yarn add istanbul-merge --dev + + - name: Run Configure + run: yarn run configure + + - name: Run tests and generate coverage reports + run: | + yarn jest --testPathPattern="packages/cactus-api-client/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-api-client + yarn jest --testPathPattern="packages/cactus-cmd-api-server/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-cmd-api-server + yarn jest --testPathPattern="packages/cactus-cmd-socketio-server/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-cmd-socketio-server + yarn jest --testPathPattern="packages/cactus-common/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-common + yarn jest --testPathPattern="packages/cactus-core/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-core + yarn jest --testPathPattern="packages/cactus-core-api/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-core-api + yarn jest --testPathPattern="examples/cactus-example-carbon-accounting-backend/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-example-carbon-accounting-backend + yarn jest --testPathPattern="examples/cactus-example-carbon-accounting-business-logic-plugin/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-example-carbon-accounting-business-logic-plugin + yarn jest --testPathPattern="examples/cactus-example-carbon-accounting-frontend/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-example-carbon-accounting-frontend + yarn jest --testPathPattern="examples/cactus-example-supply-chain-backend/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-example-supply-chain-backend + yarn jest --testPathPattern="examples/cactus-example-supply-chain-business-logic-plugin/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-example-supply-chain-business-logic-plugin + yarn jest --testPathPattern="examples/cactus-example-supply-chain-frontend/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-example-supply-chain-frontend + yarn jest --testPathPattern="packages/cactus-plugin-consortium-manual/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-consortium-manual + yarn jest --testPathPattern="extensions/cactus-plugin-htlc-coordinator-besu/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-htlc-coordinator-besu + yarn jest --testPathPattern="packages/cactus-plugin-htlc-eth-besu/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-htlc-eth-besu + yarn jest --testPathPattern="packages/cactus-plugin-htlc-eth-besu-erc20/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-htlc-eth-besu-erc20 + yarn jest --testPathPattern="packages/cactus-plugin-keychain-aws-sm/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-keychain-aws-sm + yarn jest --testPathPattern="packages/cactus-plugin-keychain-azure-kv/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-keychain-azure-kv + yarn jest --testPathPattern="packages/cactus-plugin-keychain-google-sm/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-keychain-google-sm + yarn jest --testPathPattern="packages/cactus-plugin-keychain-memory/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-keychain-memory + yarn jest --testPathPattern="packages/cactus-plugin-keychain-memory-wasm/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-keychain-memory-wasm + yarn jest --testPathPattern="packages/cactus-plugin-keychain-vault/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-keychain-vault + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-aries/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-aries + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-besu/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-besu + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-corda/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-corda + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-0 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-1 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-2 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-3 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-4 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-5 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-6 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-7 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-8 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-9 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-10 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-11 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/plugin-ledger-connector-fabric-12 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-go-ethereum-socketio + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-iroha/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-iroha + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-iroha2/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-iroha2 + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-ethereum/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-ethereum + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-quorum + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-sawtooth/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-sawtooth + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-xdai/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-ledger-connector-xdai + yarn jest --testPathPattern="packages/cactus-plugin-persistence-ethereum/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-persistence-ethereum + yarn jest --testPathPattern="extensions/cactus-plugin-object-store-ipfs/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-object-store-ipfs + yarn jest --testPathPattern="packages/cactus-plugin-ledger-connector-ubiquity/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-plugin-connector-ubiquity + yarn jest --testPathPattern="packages/cactus-test-api-client/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-api-client + yarn jest --testPathPattern="packages/cactus-test-cmd-api-server/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-cmd-api-server + yarn jest --testPathPattern="packages/cactus-test-geth-ledger/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-geth-ledger + yarn jest --testPathPattern="packages/cactus-test-plugin-consortium-manual/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-plugin-consortium-manual + yarn jest --testPathPattern="packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-plugin-htlc-eth-besu + yarn jest --testPathPattern="packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-plugin-htlc-eth-besu-erc20 + yarn jest --testPathPattern="packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-plugin-ledger-connector-besu + yarn jest --testPathPattern="packages/cactus-test-plugin-ledger-connector-quorum/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-plugin-ledger-connector-quorum + yarn jest --testPathPattern="packages/cactus-test-plugin-ledger-connector-ethereum/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-plugin-ledger-connector-ethereum + yarn jest --testPathPattern="packages/cactus-test-tooling/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-test-tooling + yarn jest --testPathPattern="packages/cactus-verifier-client/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts" --coverage --coverageDirectory=./code-coverage-ts/cactus-verifier-client + + - name: Merge coverage reports + run: npx istanbul-merge --out coverage.json ./code-coverage-ts/*/coverage-final.json + + - name: Generate HTML report + run: npx istanbul report --include coverage.json --dir cacti html + + - name: Publish coverage report + uses: actions/upload-artifact@v2 + with: + name: coverage-report + path: ./cacti