diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d98f254a2..599ecb9a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 with: distribution: temurin - java-version: '17.0.13' + java-version: "17.0.13" - name: Setup Gradle uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 @@ -51,7 +51,7 @@ jobs: cache-read-only: false - name: Build SDK & Javadoc - run: ./gradlew assemble :sdk:javadoc --scan + run: ./gradlew assemble :sdk:javadoc test: name: Unit and Integration Tests @@ -67,7 +67,7 @@ jobs: - name: Checkout Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Setup NodeJS uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 @@ -78,7 +78,7 @@ jobs: uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 with: distribution: temurin - java-version: '17.0.13' + java-version: "17.0.13" - name: Setup Gradle uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 @@ -87,27 +87,27 @@ jobs: run: npm install @hashgraph/hedera-local - name: Build SDK - run: ./gradlew assemble --scan + run: ./gradlew assemble - name: Code Quality Checks - run: ./gradlew qualityCheck :examples:qualityCheck --continue --scan + run: ./gradlew qualityCheck :examples:qualityCheck --continue - name: Start Local Node run: npx @hashgraph/hedera-local start -d --network local --network-tag=0.57.0 - name: Run Unit and Integration Tests env: - OPERATOR_KEY: '0xa608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4' - OPERATOR_ID: '0.0.1022' - HEDERA_NETWORK: 'localhost' + OPERATOR_KEY: "0xa608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4" + OPERATOR_ID: "0.0.1022" + HEDERA_NETWORK: "localhost" run: | - ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK :aggregation:testCodeCoverageReport --scan + ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK :aggregation:testCodeCoverageReport - name: Upload coverage to Codecov if: ${{ github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]') }} uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 with: - files: gradle/aggregation/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml + files: gradle/aggregation/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml - name: Stop the local node run: npx @hashgraph/hedera-local stop @@ -135,7 +135,7 @@ jobs: uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 with: distribution: temurin - java-version: '17.0.13' + java-version: "17.0.13" - name: Setup Android SDK uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2 @@ -147,10 +147,10 @@ jobs: run: npm install @hashgraph/hedera-local - name: Build SDK - run: ./gradlew assemble --scan + run: ./gradlew assemble - name: Build Android Example - run: ./gradlew -p example-android assemble --scan + run: ./gradlew -p example-android assemble - name: Start the local node run: npx @hashgraph/hedera-local start -d --network local --network-tag=0.57.0 @@ -162,52 +162,52 @@ jobs: echo "HEDERA_NETWORK=localhost" >> examples/.env - name: Run Examples - run: ./gradlew :examples:runAllExamples --scan + run: ./gradlew :examples:runAllExamples - name: Stop the local node run: npx @hashgraph/hedera-local stop test-tck: - name: TCK Tests - runs-on: client-sdk-linux-medium - needs: - - build - steps: - - name: Harden Runner - uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3 - with: - egress-policy: audit - - - name: Checkout Code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - - name: Setup NodeJS - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: 18 - - - name: Setup Java - uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 - with: - distribution: temurin - java-version: '17.0.13' - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 - - - name: Install Local Node - run: npm install @hashgraph/hedera-local - - - name: Build TCK - run: ./gradlew assemble --scan - - - name: Start Local Node - run: npx @hashgraph/hedera-local start -d --network local - - - name: Run TCK Unit Tests - run: ./gradlew :tck:test --scan - - - name: Stop the local node - run: npx @hashgraph/hedera-local stop + name: TCK Tests + runs-on: client-sdk-linux-medium + needs: + - build + steps: + - name: Harden Runner + uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3 + with: + egress-policy: audit + + - name: Checkout Code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Setup NodeJS + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: 18 + + - name: Setup Java + uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 + with: + distribution: temurin + java-version: "17.0.13" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 + + - name: Install Local Node + run: npm install @hashgraph/hedera-local + + - name: Build TCK + run: ./gradlew assemble + + - name: Start Local Node + run: npx @hashgraph/hedera-local start -d --network local + + - name: Run TCK Unit Tests + run: ./gradlew :tck:test + + - name: Stop the local node + run: npx @hashgraph/hedera-local stop diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 4a4435717..974453529 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -36,16 +36,16 @@ jobs: uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 with: distribution: temurin - java-version: '17.0.13' + java-version: "17.0.13" - name: Setup Gradle uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 - name: Compile SDK - run: ./gradlew compileJava --scan + run: ./gradlew compileJava - name: Generate Javadoc - run: ./gradlew sdk:javadoc --scan + run: ./gradlew sdk:javadoc - name: Pages uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml index ec4ebc5c6..f22cbd5e1 100644 --- a/.github/workflows/release-artifacts.yml +++ b/.github/workflows/release-artifacts.yml @@ -4,13 +4,13 @@ name: Release Artifacts on: push: tags: - - 'v*.*.*' + - "v*.*.*" workflow_dispatch: - inputs: - version: - type: string - description: Test Version String (No release to Maven Central) - required: true + inputs: + version: + type: string + description: Test Version String (No release to Maven Central) + required: true defaults: run: @@ -52,7 +52,7 @@ jobs: uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 with: distribution: temurin - java-version: '17.0.13' + java-version: "17.0.13" - name: Setup Gradle uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 @@ -80,10 +80,10 @@ jobs: - validate-release steps: - - name: Harden Runner - uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3 - with: - egress-policy: audit + - name: Harden Runner + uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3 + with: + egress-policy: audit - name: Checkout Code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -114,7 +114,7 @@ jobs: uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 with: distribution: temurin - java-version: '17.0.13' + java-version: "17.0.13" - name: Setup Gradle uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2 @@ -122,11 +122,11 @@ jobs: cache-read-only: false - name: Compile SDK & Javadoc - run: ./gradlew assemble :sdk:javadoc --scan + run: ./gradlew assemble :sdk:javadoc - name: Nexus Release if: ${{ github.event_name == 'push' }} env: - NEXUS_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - NEXUS_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - run: ./gradlew releaseMavenCentral -PpublishingPackageGroup=org.hiero -PpublishSigningEnabled=true --scan --no-configuration-cache + NEXUS_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + run: ./gradlew releaseMavenCentral -PpublishingPackageGroup=org.hiero -PpublishSigningEnabled=true --no-configuration-cache diff --git a/sdk-full/build.gradle.kts b/sdk-full/build.gradle.kts index ebbc450d4..14c076675 100644 --- a/sdk-full/build.gradle.kts +++ b/sdk-full/build.gradle.kts @@ -2,33 +2,11 @@ plugins { id("org.hiero.gradle.module.library") id("org.hiero.gradle.feature.protobuf") + id("org.hiero.gradle.feature.publish-dependency-constraints") } description = "Hedera™ Hashgraph SDK for Java" -// TODO following block to be extracted into a plugin -// https://github.com/hiero-ledger/hiero-gradle-conventions/issues/41 -val publishDependencyConstraint = - configurations.create("publishDependencyConstraint") { - extendsFrom(configurations.internal.get()) - dependencies.all { - val addedDependency = this - project.dependencies.constraints.add( - "api", - incoming.resolutionResult.rootComponent.map { - (it.dependencies.single { - it is ResolvedDependencyResult && - it.selected.moduleVersion?.group == addedDependency.group && - it.selected.moduleVersion?.name == addedDependency.name - } as ResolvedDependencyResult) - .selected - .moduleVersion - .toString() - } - ) - } - } - // Define dependency constraints for gRPC implementations so that clients automatically get the // correct version dependencies { diff --git a/sdk/build.gradle.kts b/sdk/build.gradle.kts index 57033a4b3..d40446318 100644 --- a/sdk/build.gradle.kts +++ b/sdk/build.gradle.kts @@ -3,6 +3,7 @@ plugins { id("org.hiero.gradle.module.library") id("org.hiero.gradle.feature.protobuf") id("org.hiero.gradle.feature.test-integration") + id("org.hiero.gradle.feature.publish-dependency-constraints") } description = "Hedera™ Hashgraph SDK for Java" @@ -12,29 +13,6 @@ javaModuleDependencies.moduleNameToGA.put( "com.google.protobuf:protobuf-javalite" ) -// TODO following block to be extracted into a plugin -// https://github.com/hiero-ledger/hiero-gradle-conventions/issues/41 -val publishDependencyConstraint = - configurations.create("publishDependencyConstraint") { - extendsFrom(configurations.internal.get()) - dependencies.all { - val constraint = this - project.dependencies.constraints.add( - "api", - incoming.resolutionResult.rootComponent.map { - (it.dependencies.single { - it is ResolvedDependencyResult && - it.selected.moduleVersion?.group == constraint.group && - it.selected.moduleVersion?.name == constraint.name - } as ResolvedDependencyResult) - .selected - .moduleVersion - .toString() - } - ) - } - } - // Define dependency constraints for gRPC implementations so that clients automatically get the // correct version dependencies { diff --git a/settings.gradle.kts b/settings.gradle.kts index 118698383..010a3476e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -plugins { id("org.hiero.gradle.build") version "0.1.4" } +plugins { id("org.hiero.gradle.build") version "0.3.0" } rootProject.name = "hiero-sdk-java"