Skip to content

Commit

Permalink
ci(codacy): enable Codacy coverage reporting (hashgraph#11150)
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Klick <nathan@swirldslabs.com>
  • Loading branch information
nathanklick authored Jan 25, 2024
1 parent b913225 commit 7dd36de
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/node-flow-build-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,22 @@ jobs:
java-distribution: ${{ github.event.inputs.java-distribution || 'temurin' }}
enable-unit-tests: ${{ github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' }}
enable-sonar-analysis: false
enable-integration-tests: ${{ github.event_name == 'push' || github.event.inputs.enable-integration-tests == 'true' }}
enable-hapi-tests-misc: ${{ github.event_name == 'push' || github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-crypto: ${{ github.event_name == 'push' || github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-token: ${{ github.event_name == 'push' || github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-smart-contract: ${{ github.event_name == 'push' || github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-time-consuming: ${{ github.event_name == 'push' || github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-restart: ${{ github.event_name == 'push' || github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-nd-reconnect: ${{ github.event_name == 'push' || github.event.inputs.enable-hapi-tests == 'true' }}
enable-e2e-tests: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }}
enable-integration-tests: ${{ github.event.inputs.enable-integration-tests == 'true' }}
enable-hapi-tests-misc: ${{ github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-crypto: ${{ github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-token: ${{ github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-smart-contract: ${{ github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-time-consuming: ${{ github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-restart: ${{ github.event.inputs.enable-hapi-tests == 'true' }}
enable-hapi-tests-nd-reconnect: ${{ github.event.inputs.enable-hapi-tests == 'true' }}
enable-e2e-tests: ${{ github.event.inputs.enable-e2e-tests == 'true' }}
enable-spotless-check: ${{ github.event.inputs.enable-spotless-check == 'true' }}
enable-snyk-scan: ${{ github.event_name == 'push' || github.event.inputs.enable-snyk-scan == 'true' }}
enable-network-log-capture: true
secrets:
access-token: ${{ secrets.GITHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
snyk-token: ${{ secrets.SNYK_TOKEN }}
codacy-project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
gradle-cache-username: ${{ secrets.GRADLE_CACHE_USERNAME }}
gradle-cache-password: ${{ secrets.GRADLE_CACHE_PASSWORD }}
1 change: 1 addition & 0 deletions .github/workflows/node-flow-pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
gradle-cache-username: ${{ secrets.GRADLE_CACHE_USERNAME }}
gradle-cache-password: ${{ secrets.GRADLE_CACHE_PASSWORD }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
codacy-project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}

eet-tests:
name: E2E Tests
Expand Down
36 changes: 23 additions & 13 deletions .github/workflows/node-zxc-compile-application-code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ on:
snyk-token:
description: "The Snyk access token is used by Snyk to analyze the code for vulnerabilities "
required: false
codacy-project-token:
description: "The Codacy project token used to report code coverage."
required: false

defaults:
run:
shell: bash
Expand Down Expand Up @@ -215,20 +219,20 @@ jobs:
- name: Compile
id: gradle-build
run: ${GRADLE_EXEC} assemble --scan --no-daemon
run: ${GRADLE_EXEC} assemble --scan

- name: Spotless Check
if: ${{ inputs.enable-spotless-check && !cancelled() }}
run: ${GRADLE_EXEC} spotlessCheck --scan --no-daemon
run: ${GRADLE_EXEC} spotlessCheck --scan

- name: Gradle Dependency Scopes Check
if: ${{ inputs.enable-dependency-check && steps.gradle-build.conclusion == 'success' && !cancelled() }}
run: ${GRADLE_EXEC} checkAllModuleInfo --scan --continue --no-daemon
run: ${GRADLE_EXEC} checkAllModuleInfo --scan --continue

- name: Unit Testing
id: gradle-test
if: ${{ inputs.enable-unit-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }}
run: ${GRADLE_EXEC} check --continue --scan --no-daemon
run: ${GRADLE_EXEC} test jacocoTestReport --continue --scan

- name: Publish Unit Test Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand All @@ -247,12 +251,12 @@ jobs:

- name: Build Docker Image # build the image for hedera-node
if: ${{ (inputs.enable-integration-tests || inputs.enable-e2e-tests) && steps.gradle-build.conclusion == 'success' && !cancelled() }}
run: ${GRADLE_EXEC} createDockerImage --scan --no-daemon
run: ${GRADLE_EXEC} createDockerImage --scan

- name: Integration Testing
id: gradle-itest
if: ${{ inputs.enable-integration-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }}
run: ${GRADLE_EXEC} itest --scan --no-daemon
run: ${GRADLE_EXEC} itest --scan

- name: Publish Integration Test Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand Down Expand Up @@ -302,7 +306,7 @@ jobs:
env:
LC_ALL: en.UTF-8
LANG: en_US.UTF-8
run: ${GRADLE_EXEC} hapiTestCrypto -Dfile.encoding=UTF-8 --scan --no-daemon
run: ${GRADLE_EXEC} hapiTestCrypto -Dfile.encoding=UTF-8 --scan

- name: Publish HAPI Test (Crypto) Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand All @@ -327,7 +331,7 @@ jobs:
env:
LC_ALL: en.UTF-8
LANG: en_US.UTF-8
run: ${GRADLE_EXEC} hapiTestToken -Dfile.encoding=UTF-8 --scan --no-daemon
run: ${GRADLE_EXEC} hapiTestToken -Dfile.encoding=UTF-8 --scan

- name: Publish HAPI Test (Token) Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand All @@ -352,7 +356,7 @@ jobs:
env:
LC_ALL: en.UTF-8
LANG: en_US.UTF-8
run: ${GRADLE_EXEC} hapiTestSmartContract -Dfile.encoding=UTF-8 --scan --no-daemon
run: ${GRADLE_EXEC} hapiTestSmartContract -Dfile.encoding=UTF-8 --scan

- name: Publish HAPI Test (Smart Contract) Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand All @@ -377,7 +381,7 @@ jobs:
env:
LC_ALL: en.UTF-8
LANG: en_US.UTF-8
run: ${GRADLE_EXEC} hapiTestTimeConsuming -Dfile.encoding=UTF-8 --scan --no-daemon
run: ${GRADLE_EXEC} hapiTestTimeConsuming -Dfile.encoding=UTF-8 --scan

- name: Publish HAPI Test (Time Consuming) Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand All @@ -402,7 +406,7 @@ jobs:
env:
LC_ALL: en.UTF-8
LANG: en_US.UTF-8
run: ${GRADLE_EXEC} hapiTestRestart -Dfile.encoding=UTF-8 --scan --no-daemon
run: ${GRADLE_EXEC} hapiTestRestart -Dfile.encoding=UTF-8 --scan

- name: Publish HAPI Test (Restart) Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand All @@ -428,7 +432,7 @@ jobs:
env:
LC_ALL: en.UTF-8
LANG: en_US.UTF-8
run: ${GRADLE_EXEC} hapiTestNDReconnect -Dfile.encoding=UTF-8 --scan --no-daemon
run: ${GRADLE_EXEC} hapiTestNDReconnect -Dfile.encoding=UTF-8 --scan

- name: Publish HAPI Test (Node Death Reconnect) Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand All @@ -451,7 +455,7 @@ jobs:
- name: E2E Testing
id: gradle-eet
if: ${{ inputs.enable-e2e-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }}
run: ${GRADLE_EXEC} eet --scan --no-daemon
run: ${GRADLE_EXEC} eet --scan

- name: Publish E2E Test Report
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
Expand All @@ -474,6 +478,12 @@ jobs:
if: ${{ inputs.enable-unit-tests && !cancelled() }}
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4

- name: Publish to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.codacy-project-token }}
if: ${{ inputs.enable-unit-tests && !cancelled() }}
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java $(find . -name 'jacoco*.xml' -printf '-r %p ')

- name: Publish Test Reports
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: ${{ inputs.enable-unit-tests && !cancelled() }}
Expand Down

0 comments on commit 7dd36de

Please sign in to comment.