Skip to content

Commit

Permalink
testing code coverage logic on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
aldousalvarez committed Apr 29, 2024
1 parent 6be6447 commit a8b3201
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ jobs:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-api-client/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/cactus-api-client
JEST_TEST_CODE_COVERAGE_DISABLED: true
TAPE_TEST_PATTERN: ./packages/cactus-api-client/src/test/typescript/integration/default-consortium-provider.test.ts
TAPE_TEST_RUNNER_DISABLED: false
needs: build-dev
Expand All @@ -363,6 +365,16 @@ jobs:
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh

- name: Merge coverage reports
run: npx istanbul-merge --out coverage.json ./code-coverage-ts/cactus-api-client/coverage-final.json

- name: Upload coverage reports as artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: ./code-coverage-ts/cactus-api-client

cactus-cmd-api-server:
continue-on-error: false
needs:
Expand All @@ -374,6 +386,8 @@ jobs:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-cmd-api-server/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/cactus-cmd-api-server
JEST_TEST_CODE_COVERAGE_DISABLED: true
TAPE_TEST_PATTERN: >-
--files={./packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-from-github.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-without-install.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/config/self-signed-certificate-generator/certificates-work-for-mutual-tls.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/config/self-signed-certificate-generator/generates-working-certificates.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-js-proto-loader-client-healthcheck.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-consortium-manual.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-keychain-memory.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-ledger-connector-fabric-0-7-0.test.ts,./packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-ledger-connector-quorum-0-7-0.test.ts}
TAPE_TEST_RUNNER_DISABLED: false
Expand Down Expand Up @@ -432,6 +446,8 @@ jobs:
env:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-cmd-socketio-server/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/cactus-cmd-socketio-server
JEST_TEST_CODE_COVERAGE_DISABLED: true
JEST_TEST_RUNNER_DISABLED: false
TAPE_TEST_RUNNER_DISABLED: true
needs: build-dev
Expand All @@ -454,13 +470,25 @@ jobs:
- run: ./tools/ci.sh


- name: Merge coverage reports
run: npx istanbul-merge --out coverage.json ./code-coverage-ts/cactus-cmd-socketio-server/coverage-final.json

- name: Upload coverage reports as artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: ./code-coverage-ts/cactus-cmd-socketio-server

cactus-common:
continue-on-error: false
env:
DEV_BUILD_DISABLED: false
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-common/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/cactus-common
JEST_TEST_CODE_COVERAGE_DISABLED: true
TAPE_TEST_PATTERN: '--files={./packages/cactus-common/src/test/typescript/unit/key-converter.test.ts,./packages/cactus-common/src/test/typescript/unit/logging/logger.test.ts}'
TAPE_TEST_RUNNER_DISABLED: false
needs: build-dev
Expand All @@ -482,12 +510,24 @@ jobs:
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh

- name: Merge coverage reports
run: npx istanbul-merge --out coverage.json ./code-coverage-ts/cactus-common/coverage-final.json

- name: Upload coverage reports as artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: ./code-coverage-ts/cactus-common

cactus-core:
continue-on-error: false
env:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-core/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/cactus-core
JEST_TEST_CODE_COVERAGE_DISABLED: true
TAPE_TEST_RUNNER_DISABLED: true
needs: build-dev
runs-on: ubuntu-22.04
Expand All @@ -507,12 +547,24 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh

- name: Merge coverage reports
run: npx istanbul-merge --out coverage.json ./code-coverage-ts/cactus-core/coverage-final.json

- name: Upload coverage reports as artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: ./code-coverage-ts/cactus-core

cactus-core-api:
continue-on-error: false
env:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: packages/cactus-core-api/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/cactus-core-api
JEST_TEST_CODE_COVERAGE_DISABLED: true
TAPE_TEST_RUNNER_DISABLED: true
needs: build-dev
runs-on: ubuntu-22.04
Expand All @@ -532,12 +584,24 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh

- name: Merge coverage reports
run: npx istanbul-merge --out coverage.json ./code-coverage-ts/cactus-core-api/coverage-final.json

- name: Upload coverage reports as artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: ./code-coverage-ts/cactus-core-api

cactus-example-carbon-accounting-backend:
continue-on-error: false
env:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: examples/cactus-example-carbon-accounting-backend/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/cactus-example-carbon-accounting-backend
JEST_TEST_CODE_COVERAGE_DISABLED: true
TAPE_TEST_PATTERN: ./examples/cactus-example-carbon-accounting-backend/src/test/typescript/integration/admin-enroll-v1-endpoint.test.ts
TAPE_TEST_RUNNER_DISABLED: false
needs: build-dev
Expand All @@ -558,12 +622,24 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh

- name: Merge coverage reports
run: npx istanbul-merge --out coverage.json ./code-coverage-ts/cactus-example-carbon-accounting-backend/coverage-final.json

- name: Upload coverage reports as artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: ./code-coverage-ts/cactus-example-carbon-accounting-backend

cactus-example-carbon-accounting-business-logic-plugin:
continue-on-error: false
env:
FULL_BUILD_DISABLED: true
JEST_TEST_PATTERN: examples/cactus-example-carbon-accounting-business-logic-plugin/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/ cactus-example-carbon-accounting-business-logic-plugin
JEST_TEST_CODE_COVERAGE_DISABLED: true
TAPE_TEST_RUNNER_DISABLED: true
needs: build-dev
runs-on: ubuntu-22.04
Expand All @@ -583,6 +659,16 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh

- name: Merge coverage reports
run: npx istanbul-merge --out coverage.json ./code-coverage-ts/cactus-example-carbon-accounting-business-logic-plugin/coverage-final.json

- name: Upload coverage reports as artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: ./code-coverage-ts/cactus-example-carbon-accounting-business-logic-plugin

cactus-example-carbon-accounting-frontend:
continue-on-error: false
env:
Expand Down Expand Up @@ -2313,6 +2399,8 @@ jobs:
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'


name: Cactus_CI
'on':
pull_request:
Expand Down
2 changes: 2 additions & 0 deletions tools/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ function mainTask()

if [ "${JEST_TEST_RUNNER_DISABLED:-false}" = "true" ]; then
echo "$(date +%FT%T%z) [CI] Jest test runner disabled. Skipping..."
elif [ "${JEST_TEST_CODE_COVERAGE_DISABLED:-false} = 'true"]; then
yarn test:jest:all $JEST_TEST_PATTERN --coverage --coverageDirectory=$JEST_TEST_COVERAGE_PATH
else
yarn test:jest:all $JEST_TEST_PATTERN
fi
Expand Down

0 comments on commit a8b3201

Please sign in to comment.