From d8d505bd8b167eb97cb997bc4fded71982f8e3ff Mon Sep 17 00:00:00 2001 From: Jendrik Johannes Date: Mon, 16 Dec 2024 13:12:11 +0100 Subject: [PATCH] build: repair running test AND testIntegration with code coverage on CI This now follows a similar setup as in hedera-services. This update was missed in #2033. Signed-off-by: Jendrik Johannes --- .github/workflows/build.yml | 2 +- .github/workflows/disabled/testnet.yml | 2 +- gradle/aggregation/build.gradle.kts | 27 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5a809d12..24747c3f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -101,7 +101,7 @@ jobs: OPERATOR_ID: '0.0.1022' HEDERA_NETWORK: 'localhost' run: | - ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK jacocoTestReport --scan + ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK :aggregation:testCodeCoverageReport --scan - name: Upload coverage to Codecov if: ${{ github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') }} diff --git a/.github/workflows/disabled/testnet.yml b/.github/workflows/disabled/testnet.yml index cabaece6c..56000afdb 100644 --- a/.github/workflows/disabled/testnet.yml +++ b/.github/workflows/disabled/testnet.yml @@ -93,7 +93,7 @@ jobs: OPERATOR_ID: ${{ secrets.TESTNET_OPERATOR_ID }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | - ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=testnet jacocoTestReport && bash <(curl -s https://codecov.io/bash) + ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=testnet :aggregation:testCodeCoverageReport && bash <(curl -s https://codecov.io/bash) - uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/gradle/aggregation/build.gradle.kts b/gradle/aggregation/build.gradle.kts index aa94166ca..de9843689 100644 --- a/gradle/aggregation/build.gradle.kts +++ b/gradle/aggregation/build.gradle.kts @@ -10,3 +10,30 @@ dependencies { implementation(project(":sdk")) implementation("io.grpc:grpc-protobuf") } + +tasks.testCodeCoverageReport { + // Integrate coverage data from integration tests into the report + @Suppress("UnstableApiUsage") val testIntegrationExecutionData = + configurations.aggregateCodeCoverageReportResults + .get() + .incoming + .artifactView { + withVariantReselection() + componentFilter { id -> id is ProjectComponentIdentifier } + attributes.attribute( + Category.CATEGORY_ATTRIBUTE, + objects.named(Category.VERIFICATION) + ) + attributes.attribute( + VerificationType.VERIFICATION_TYPE_ATTRIBUTE, + objects.named(VerificationType.JACOCO_RESULTS) + ) + attributes.attribute( + TestSuiteType.TEST_SUITE_TYPE_ATTRIBUTE, + objects.named(TestSuiteType.INTEGRATION_TEST) + ) + } + .files + + executionData.from(testIntegrationExecutionData) +}