From 4fd6552384355dff42441bfeb4471d94f8622897 Mon Sep 17 00:00:00 2001 From: Deepak Bomjan Date: Sat, 22 Jun 2024 17:39:05 +0545 Subject: [PATCH] ci: configure codecov --- .github/workflows/java-codecov.yml | 23 +++++++++++++++++++ README.md | 1 + core-contracts/AssetManager/build.gradle | 2 +- core-contracts/BalancedOracle/build.gradle | 3 ++- core-contracts/BatchDisbursement/build.gradle | 9 ++++++++ core-contracts/Bribing/build.gradle | 2 +- core-contracts/DAOfund/build.gradle | 2 +- core-contracts/Dex/build.gradle | 3 ++- core-contracts/Dividends/build.gradle | 2 +- core-contracts/FeeHandler/build.gradle | 2 +- core-contracts/Governance/build.gradle | 2 +- core-contracts/Loans/build.gradle | 2 +- core-contracts/Multicall/build.gradle | 9 ++++++++ core-contracts/Rebalancing/build.gradle | 3 ++- core-contracts/Reserve/build.gradle | 2 +- core-contracts/Rewards/build.gradle | 7 +++++- core-contracts/Router/build.gradle | 2 +- core-contracts/Savings/build.gradle | 2 +- core-contracts/StakedLP/build.gradle | 3 ++- core-contracts/Staking/build.gradle | 2 +- score-lib/build.gradle | 2 +- .../SpokeAssetManager/build.gradle | 3 ++- .../SpokeBalancedDollar/build.gradle | 3 ++- test-lib/build.gradle | 10 ++++++++ token-contracts/BalancedDollar/build.gradle | 2 +- token-contracts/BalancedToken/build.gradle | 2 +- token-contracts/Sicx/build.gradle | 2 +- token-contracts/WorkerToken/build.gradle | 9 ++++++++ token-contracts/bBaln/build.gradle | 2 +- util-contracts/Burner/build.gradle | 10 ++++++++ util-contracts/DummyOracle/build.gradle | 10 ++++++++ util-contracts/OTC/build.gradle | 2 +- util-contracts/Stability/build.gradle | 10 ++++++++ util-contracts/Trickler/build.gradle | 2 +- util-contracts/XCallManager/build.gradle | 2 +- util-contracts/XCallMock/build.gradle | 10 ++++++++ xcall-annotations/build.gradle | 14 +++++++++++ 37 files changed, 152 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/java-codecov.yml diff --git a/.github/workflows/java-codecov.yml b/.github/workflows/java-codecov.yml new file mode 100644 index 000000000..04bd7807b --- /dev/null +++ b/.github/workflows/java-codecov.yml @@ -0,0 +1,23 @@ +name: Codecov javascore + +on: + push: + branches: + - "**" +env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} +jobs: + Coverage-Codecov: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: true + - name: Javascore contracts coverage + run: ./gradlew test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + flags: java \ No newline at end of file diff --git a/README.md b/README.md index 107bb7291..74b534376 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ![Gradle](https://img.shields.io/badge/gradle-7.4.2-blue) [![build](https://github.com/balancednetwork/balanced-java-contracts/actions/workflows/pr-test.yml/badge.svg?branch=main)](https://github.com/balancednetwork/balanced-java-contracts/actions/workflows/pr-test.yml) +[![codecov](https://codecov.io/gh/balancednetwork/balanced-java-contracts/graph/badge.svg?token=ESRLDMPPTG)](https://codecov.io/gh/balancednetwork/balanced-java-contracts) This repository contains the smart contracts for Balanced in Java. For python contracts check [balanced-contracts]( https://github.com/balancednetwork/balanced-contracts). diff --git a/core-contracts/AssetManager/build.gradle b/core-contracts/AssetManager/build.gradle index cc0e17254..60a271c11 100644 --- a/core-contracts/AssetManager/build.gradle +++ b/core-contracts/AssetManager/build.gradle @@ -106,7 +106,7 @@ test { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/BalancedOracle/build.gradle b/core-contracts/BalancedOracle/build.gradle index f6460ae13..27642f8a9 100644 --- a/core-contracts/BalancedOracle/build.gradle +++ b/core-contracts/BalancedOracle/build.gradle @@ -44,6 +44,7 @@ dependencies { testImplementation project(':test-lib') } + optimizedJar { mainClassName = 'network.balanced.score.core.balancedoracle.BalancedOracleImpl' duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -91,7 +92,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/BatchDisbursement/build.gradle b/core-contracts/BatchDisbursement/build.gradle index 499be1854..1f31cc733 100644 --- a/core-contracts/BatchDisbursement/build.gradle +++ b/core-contracts/BatchDisbursement/build.gradle @@ -84,3 +84,12 @@ tasks.named('test') { // Use JUnit Platform for unit tests. useJUnitPlatform() } + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } +} diff --git a/core-contracts/Bribing/build.gradle b/core-contracts/Bribing/build.gradle index 8b18b23fa..b849e64c6 100644 --- a/core-contracts/Bribing/build.gradle +++ b/core-contracts/Bribing/build.gradle @@ -92,7 +92,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/DAOfund/build.gradle b/core-contracts/DAOfund/build.gradle index e0901a264..550ed4ecb 100644 --- a/core-contracts/DAOfund/build.gradle +++ b/core-contracts/DAOfund/build.gradle @@ -98,7 +98,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Dex/build.gradle b/core-contracts/Dex/build.gradle index fe7f89421..37ee967af 100644 --- a/core-contracts/Dex/build.gradle +++ b/core-contracts/Dex/build.gradle @@ -65,6 +65,7 @@ dependencies { } + optimizedJar { mainClassName = 'network.balanced.score.core.dex.DexImpl' duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -116,7 +117,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Dividends/build.gradle b/core-contracts/Dividends/build.gradle index 5a4a1265e..fb3175029 100644 --- a/core-contracts/Dividends/build.gradle +++ b/core-contracts/Dividends/build.gradle @@ -100,7 +100,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/FeeHandler/build.gradle b/core-contracts/FeeHandler/build.gradle index eac1dd2cd..64e074800 100644 --- a/core-contracts/FeeHandler/build.gradle +++ b/core-contracts/FeeHandler/build.gradle @@ -89,7 +89,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Governance/build.gradle b/core-contracts/Governance/build.gradle index 7b3db98d1..c8cb73ff8 100644 --- a/core-contracts/Governance/build.gradle +++ b/core-contracts/Governance/build.gradle @@ -105,7 +105,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Loans/build.gradle b/core-contracts/Loans/build.gradle index ef17c6487..bcce5240f 100644 --- a/core-contracts/Loans/build.gradle +++ b/core-contracts/Loans/build.gradle @@ -98,7 +98,7 @@ test { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Multicall/build.gradle b/core-contracts/Multicall/build.gradle index ed1a752b3..6a7371194 100644 --- a/core-contracts/Multicall/build.gradle +++ b/core-contracts/Multicall/build.gradle @@ -81,3 +81,12 @@ tasks.named('test') { // Use JUnit Platform for unit tests. useJUnitPlatform() } + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } +} diff --git a/core-contracts/Rebalancing/build.gradle b/core-contracts/Rebalancing/build.gradle index 2a93d29c5..3819ae743 100644 --- a/core-contracts/Rebalancing/build.gradle +++ b/core-contracts/Rebalancing/build.gradle @@ -40,6 +40,7 @@ dependencies { testImplementation project(':test-lib') } + optimizedJar { mainClassName = 'network.balanced.score.core.rebalancing.RebalancingImpl' duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -93,7 +94,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Reserve/build.gradle b/core-contracts/Reserve/build.gradle index 46a2031ad..d236728f9 100644 --- a/core-contracts/Reserve/build.gradle +++ b/core-contracts/Reserve/build.gradle @@ -98,7 +98,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Rewards/build.gradle b/core-contracts/Rewards/build.gradle index d8de9d358..1de4297c1 100644 --- a/core-contracts/Rewards/build.gradle +++ b/core-contracts/Rewards/build.gradle @@ -43,6 +43,11 @@ dependencies { intTestImplementation Dependencies.jacksonDatabind } +test { + useJUnitPlatform() + finalizedBy jacocoTestReport +} + optimizedJar { mainClassName = 'network.balanced.score.core.rewards.RewardsImpl' duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -96,7 +101,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Router/build.gradle b/core-contracts/Router/build.gradle index c53aedf2a..61298ffd8 100644 --- a/core-contracts/Router/build.gradle +++ b/core-contracts/Router/build.gradle @@ -94,7 +94,7 @@ test { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Savings/build.gradle b/core-contracts/Savings/build.gradle index f48e4dfda..25f3b7851 100644 --- a/core-contracts/Savings/build.gradle +++ b/core-contracts/Savings/build.gradle @@ -99,7 +99,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/StakedLP/build.gradle b/core-contracts/StakedLP/build.gradle index b75873b9b..455a4f499 100644 --- a/core-contracts/StakedLP/build.gradle +++ b/core-contracts/StakedLP/build.gradle @@ -46,6 +46,7 @@ dependencies { intTestImplementation Dependencies.jacksonDatabind } + optimizedJar { mainClassName = 'network.balanced.score.core.stakedlp.StakedLPImpl' duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -97,7 +98,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/core-contracts/Staking/build.gradle b/core-contracts/Staking/build.gradle index 6cf26560a..11de3fa82 100644 --- a/core-contracts/Staking/build.gradle +++ b/core-contracts/Staking/build.gradle @@ -100,7 +100,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/score-lib/build.gradle b/score-lib/build.gradle index 79b56c840..f0ce97d3c 100644 --- a/score-lib/build.gradle +++ b/score-lib/build.gradle @@ -59,7 +59,7 @@ test { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/spoke-contracts/SpokeAssetManager/build.gradle b/spoke-contracts/SpokeAssetManager/build.gradle index 234cb3e09..ebd579412 100644 --- a/spoke-contracts/SpokeAssetManager/build.gradle +++ b/spoke-contracts/SpokeAssetManager/build.gradle @@ -49,6 +49,7 @@ dependencies { testImplementation project(':test-lib') } + optimizedJar { mainClassName = 'network.balanced.score.spoke.asset.manager.SpokeAssetManagerImpl' duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -87,7 +88,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/spoke-contracts/SpokeBalancedDollar/build.gradle b/spoke-contracts/SpokeBalancedDollar/build.gradle index e61b221f0..bfceb442c 100644 --- a/spoke-contracts/SpokeBalancedDollar/build.gradle +++ b/spoke-contracts/SpokeBalancedDollar/build.gradle @@ -49,6 +49,7 @@ dependencies { testImplementation project(':test-lib') } + optimizedJar { mainClassName = 'network.balanced.score.spoke.bnusd.SpokeBalancedDollarImpl' duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -87,7 +88,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/test-lib/build.gradle b/test-lib/build.gradle index 84bb518b1..8d2eedcea 100644 --- a/test-lib/build.gradle +++ b/test-lib/build.gradle @@ -49,4 +49,14 @@ dependencies { test { useJUnitPlatform() + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } } \ No newline at end of file diff --git a/token-contracts/BalancedDollar/build.gradle b/token-contracts/BalancedDollar/build.gradle index 11c75149b..4c2f5909c 100644 --- a/token-contracts/BalancedDollar/build.gradle +++ b/token-contracts/BalancedDollar/build.gradle @@ -92,7 +92,7 @@ test { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/token-contracts/BalancedToken/build.gradle b/token-contracts/BalancedToken/build.gradle index 0c5ebe431..b49057ab2 100644 --- a/token-contracts/BalancedToken/build.gradle +++ b/token-contracts/BalancedToken/build.gradle @@ -93,7 +93,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/token-contracts/Sicx/build.gradle b/token-contracts/Sicx/build.gradle index 83bb30407..1db63544e 100644 --- a/token-contracts/Sicx/build.gradle +++ b/token-contracts/Sicx/build.gradle @@ -95,7 +95,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/token-contracts/WorkerToken/build.gradle b/token-contracts/WorkerToken/build.gradle index 9bfbf4fd4..3b37c6844 100644 --- a/token-contracts/WorkerToken/build.gradle +++ b/token-contracts/WorkerToken/build.gradle @@ -74,8 +74,17 @@ deployJar { test { useJUnitPlatform() + finalizedBy jacocoTestReport } +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } +} optimizedJar { mainClassName = 'network.balanced.score.tokens.workertoken.WorkerTokenImpl' duplicatesStrategy = DuplicatesStrategy.EXCLUDE diff --git a/token-contracts/bBaln/build.gradle b/token-contracts/bBaln/build.gradle index 88ddaf638..fa721cf33 100644 --- a/token-contracts/bBaln/build.gradle +++ b/token-contracts/bBaln/build.gradle @@ -96,7 +96,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/util-contracts/Burner/build.gradle b/util-contracts/Burner/build.gradle index 49954afbc..2252a5420 100644 --- a/util-contracts/Burner/build.gradle +++ b/util-contracts/Burner/build.gradle @@ -83,4 +83,14 @@ deployJar { test { useJUnitPlatform() + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } } \ No newline at end of file diff --git a/util-contracts/DummyOracle/build.gradle b/util-contracts/DummyOracle/build.gradle index bd94ca55b..f26cf9dce 100644 --- a/util-contracts/DummyOracle/build.gradle +++ b/util-contracts/DummyOracle/build.gradle @@ -68,4 +68,14 @@ deployJar { test { useJUnitPlatform() + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } } \ No newline at end of file diff --git a/util-contracts/OTC/build.gradle b/util-contracts/OTC/build.gradle index 38dcb8b40..d0706a95d 100644 --- a/util-contracts/OTC/build.gradle +++ b/util-contracts/OTC/build.gradle @@ -88,7 +88,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/util-contracts/Stability/build.gradle b/util-contracts/Stability/build.gradle index eaf5489b2..eb2a67a20 100644 --- a/util-contracts/Stability/build.gradle +++ b/util-contracts/Stability/build.gradle @@ -91,4 +91,14 @@ deployJar { test { useJUnitPlatform() + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } } \ No newline at end of file diff --git a/util-contracts/Trickler/build.gradle b/util-contracts/Trickler/build.gradle index 5cb5adb1e..370b3d791 100644 --- a/util-contracts/Trickler/build.gradle +++ b/util-contracts/Trickler/build.gradle @@ -82,7 +82,7 @@ test { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/util-contracts/XCallManager/build.gradle b/util-contracts/XCallManager/build.gradle index dd59beb56..aa24bd39c 100644 --- a/util-contracts/XCallManager/build.gradle +++ b/util-contracts/XCallManager/build.gradle @@ -95,7 +95,7 @@ tasks.named('test') { jacocoTestReport { dependsOn test reports { - xml.required = false + xml.required = true csv.required = false html.outputLocation = layout.buildDirectory.dir('jacocoHtml') } diff --git a/util-contracts/XCallMock/build.gradle b/util-contracts/XCallMock/build.gradle index 5dcb20793..f557ce1f3 100644 --- a/util-contracts/XCallMock/build.gradle +++ b/util-contracts/XCallMock/build.gradle @@ -89,4 +89,14 @@ deployJar { test { useJUnitPlatform() + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } } \ No newline at end of file diff --git a/xcall-annotations/build.gradle b/xcall-annotations/build.gradle index 1ab0fc306..cdd51acee 100644 --- a/xcall-annotations/build.gradle +++ b/xcall-annotations/build.gradle @@ -41,3 +41,17 @@ dependencies { implementation Dependencies.jacksonDatabind implementation Dependencies.iconSdk } + +test { + useJUnitPlatform() + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + csv.required = false + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } +} \ No newline at end of file