Skip to content

Commit

Permalink
build: update hiero-gradle-conventions to 0.3.0
Browse files Browse the repository at this point in the history
Signed-off-by: Jendrik Johannes <[email protected]>
  • Loading branch information
jjohannes committed Jan 14, 2025
1 parent 3d882e6 commit a1322b9
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 124 deletions.
116 changes: 58 additions & 58 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ 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
with:
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -114,19 +114,19 @@ 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
with:
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
24 changes: 1 addition & 23 deletions sdk-full/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
24 changes: 1 addition & 23 deletions sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"

Expand Down

0 comments on commit a1322b9

Please sign in to comment.