Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: upgrade gradle & java compatibility #167

Merged
merged 6 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use Java Version ${{ matrix.java }}
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: "zulu"
distribution: "temurin"
java-version: ${{ matrix.java }}
cache: "gradle"

- name: Install
run: gradle dependencies
- name: Install Dependencies
run: ./gradlew dependencies

- name: Test
run: gradle integrationTest
- name: Run Integration Tests
run: ./gradlew integrationTest
env:
INTEGRATION_TESTS_MNEMONIC: ${{ secrets.MNEMONIC }}
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Publish package to the Maven Central Repository

on:
release:
types: [created]
Expand All @@ -18,16 +19,16 @@ jobs:
packages: write

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
java-version: "17"
distribution: "temurin"

- name: Publish to the Maven Central Repository
run: gradle publish
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
Expand Down
59 changes: 37 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Merge Conflict finder
uses: olivernybroe/[email protected]

- name: Use Java Version 8
uses: actions/setup-java@v2
- name: Use Java 17
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: 8
distribution: "temurin"
java-version: "17"
cache: "gradle"

- name: Format code
run: gradle format
run: ./gradlew formatCode

- name: Commit fixed code
uses: stefanzweifel/git-auto-commit-action@v4
Expand All @@ -41,30 +38,48 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# test against the latest update of each major Java version, as well as specific updates of LTS versions:
java: [8, 11, 15, 16, 17, 18, 19, 20, 21, 22]
java: [17, 18, 19, 20, 21]

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Merge Conflict finder
uses: olivernybroe/[email protected]

- name: Use Java Version ${{ matrix.java }}
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: "zulu"
distribution: "temurin"
java-version: ${{ matrix.java }}
cache: "gradle"

- name: Install
run: gradle dependencies
- name: Install Dependencies
run: ./gradlew dependencies

- name: Test
run: gradle test && gradle jacocoTestReport
- name: Run Tests
run: ./gradlew test jacocoTestReport

- name: Upload Test Results
uses: actions/upload-artifact@v3
with:
name: test-results
path: build/reports/tests/test

- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: build/reports/jacoco/test/html

- name: Upload Jacoco XML Report
uses: actions/upload-artifact@v3
with:
name: jacoco-xml-report
path: build/reports/jacoco/test/jacocoTestReport.xml

- name: Codecov
run: bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/reports/jacoco/test/jacocoTestReport.xml
fail_ci_if_error: true
51 changes: 21 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ plugins {
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'com.diffplug.spotless' version '5.6.1'
id 'com.diffplug.spotless' version '6.25.0'
}

group = 'org.arkecosystem'
version = '2.0.0'

sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '2.0.0-mainsail'

repositories {
mavenLocal()
Expand All @@ -30,9 +27,9 @@ configurations {
}

dependencies {
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.8.1'
implementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '4.9.0'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
implementation 'com.squareup.okhttp3:mockwebserver:4.9.0'
implementation 'com.google.code.gson:gson:2.8.6'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testImplementation 'org.hamcrest:hamcrest-library:2.2'
Expand All @@ -41,14 +38,16 @@ dependencies {
integrationImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
integrationImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
integrationImplementation 'org.hamcrest:hamcrest-library:2.2'
integrationImplementation 'org.arkecosystem:crypto:2.0.0'
integrationCompileOnly 'org.slf4j:slf4j-api:1.7.32'
integrationRuntimeOnly 'org.slf4j:slf4j-simple:1.7.32'
integrationImplementation 'com.github.rholder:guava-retrying:2.0.0'
integrationImplementation "cash.z.ecc.android:kotlin-bip39:1.0.2"
integrationImplementation 'cash.z.ecc.android:kotlin-bip39:1.0.2'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withJavadocJar()
withSourcesJar()
}
Expand All @@ -74,25 +73,13 @@ spotless {
include 'src/test/**/*.java'
exclude '**/build/**'
}
googleJavaFormat('1.1').aosp()
googleJavaFormat('1.17.0').aosp()
removeUnusedImports()
}
}

task formatCode(dependsOn: ['spotlessApply'])

task fatJar(type: Jar) {
manifest.from jar.manifest
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
}

build.dependsOn 'spotlessApply'

tasks.register('integrationTest', Test) {
Expand All @@ -107,18 +94,16 @@ tasks.register('integrationTest', Test) {
}

wrapper {
gradleVersion = '7.2'
gradleVersion = '8.4.1'
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
groupId = project.group
version = project.version
artifactId = 'client'
artifactId = 'client'

pom {
name = 'java-client'
description = 'A Simple REST API Client Implementation in Java for the ARK CORE Blockchain Framework.'
url = 'https://sdk.ark.dev/java/client'
Expand Down Expand Up @@ -181,8 +166,14 @@ publishing {
}

signing {
// Only sign when publishing to remote repository
required { gradle.taskGraph.hasTask("publish") && !gradle.taskGraph.hasTask("publishToMavenLocal") }

def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey as String, signingPassword as String)
sign publishing.publications.mavenJava

if (signingKey && signingPassword) {
useInMemoryPgpKeys(signingKey as String, signingPassword as String)
sign publishing.publications.mavenJava
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading