Skip to content

Commit

Permalink
Merge pull request #299 from rsksmart/vovchyk/java21-support
Browse files Browse the repository at this point in the history
chore: add java21 support
  • Loading branch information
marcos-iov authored Sep 25, 2024
2 parents 39540e8 + 7dba79a commit 1a0e26a
Show file tree
Hide file tree
Showing 5 changed files with 273 additions and 269 deletions.
103 changes: 78 additions & 25 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ jobs:
with:
fetch-depth: 0

- name: Setup Java JDK
uses: actions/setup-java@v3
- name: Setup Java & Gradle
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Download rskj
uses: actions/download-artifact@v4
Expand All @@ -112,19 +113,19 @@ jobs:
path: rskj

- uses: actions/cache@v4
name: Cache Gradle
id: cache-gradle
name: Cache Gradle Wrapper
id: cache-gradle-wrapper
with:
path: |
.gradle/caches
gradle/wrapper
DONT-COMMIT-settings.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Get gradle wrapper and build dependencies
if: steps.cache-gradle.outputs.cache-hit != 'true'
gradle/wrapper/gradle-wrapper.jar
key: gradle-wrapper-v1

- name: Get Gradle wrapper
if: steps.cache-gradle-wrapper.outputs.cache-hit != 'true'
run: |
./configure.sh
- name: Set DONT-COMMIT-settings.gradle
run: |
cat <<'EOF' >DONT-COMMIT-settings.gradle
includeBuild('./rskj') {
Expand All @@ -144,9 +145,6 @@ jobs:
}
}
EOF
if [ -d ".gradle" ]; then rm -rfv .gradle; fi
./configure.sh
./gradlew --no-daemon --settings-file DONT-COMMIT-settings.gradle dependencies
- name: Build node
run: |
Expand All @@ -161,18 +159,19 @@ jobs:
!rskj
retention-days: 7

federator-tests:
federator-tests-java17:
runs-on: ubuntu-latest
needs: build_federator_node
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java JDK
uses: actions/setup-java@v3
- name: Setup Java & Gradle
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Download Build files
uses: actions/download-artifact@v4
Expand All @@ -186,6 +185,14 @@ jobs:
name: rskj
path: rskj

- uses: actions/cache/restore@v4
name: Restore Gradle Wrapper
with:
path: |
gradle/wrapper/gradle-wrapper.jar
key: gradle-wrapper-v1
fail-on-cache-miss: true

- name: Perform federator tests
run: |
./gradlew --no-daemon --stacktrace test
Expand All @@ -206,16 +213,48 @@ jobs:
build/reports/
retention-days: 7

sonarqube:
federator-tests-java21:
runs-on: ubuntu-latest
needs: federator-tests
needs: build_federator_node
steps:
- name: Setup Java JDK
uses: actions/setup-java@v3
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java & Gradle
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: 'gradle'

- name: Download Build files
uses: actions/download-artifact@v4
with:
name: build_files
path: ./

- name: Download rskj
uses: actions/download-artifact@v4
with:
name: rskj
path: rskj

- uses: actions/cache/restore@v4
name: Restore Gradle Wrapper
with:
path: |
gradle/wrapper/gradle-wrapper.jar
key: gradle-wrapper-v1
fail-on-cache-miss: true

- name: Perform federator tests
run: |
./gradlew --no-daemon --stacktrace test
sonarqube:
runs-on: ubuntu-latest
needs: federator-tests-java17
steps:
- name: Download Build files
uses: actions/download-artifact@v4
with:
Expand All @@ -241,6 +280,21 @@ jobs:
path: |
build/reports/
- name: Setup Java & Gradle
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- uses: actions/cache/restore@v4
name: Restore Gradle Wrapper
with:
path: |
gradle/wrapper/gradle-wrapper.jar
key: gradle-wrapper-v1
fail-on-cache-miss: true

- name: Run SonarQube analysis
env:
GH_EVENT: ${{ github.event_name }}
Expand Down Expand Up @@ -272,4 +326,3 @@ jobs:
-Dsonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml \
-Dsonar.token="$SONAR_TOKEN"
fi
17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.util.jar.JarOutputStream
plugins {
id 'application'
id "jacoco"
id "org.sonarqube" version "2.7.1"
id "org.sonarqube" version "5.1.0.4882"
}

def config = new ConfigSlurper().parse(new File("$projectDir/src/main/resources/version.properties").toURI().toURL())
Expand Down Expand Up @@ -70,9 +70,10 @@ ext {
jacksonDatabindVersion = '2.15.4'
typesafeVersion = '1.4.2'
logbackVersion = '1.2.11'
junitVersion = '5.8.1'
junitSuiteVersion = '1.9.0'
mockitoVersion = '4.6.1'
junitVersion = '5.10.3'
junitSuiteVersion = '1.10.3'
mockitoInlineVer = '5.2.0'
mockitoJupiterVer = '5.12.0'
rskjcoreVersion = '6.4.0-SNAPSHOT'
}

Expand All @@ -95,8 +96,8 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testImplementation "org.junit.platform:junit-platform-suite:${junitSuiteVersion}"
testImplementation "org.mockito:mockito-inline:${mockitoVersion}"
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
testImplementation "org.mockito:mockito-inline:${mockitoInlineVer}"
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoJupiterVer}"
}

javadoc {
Expand All @@ -107,12 +108,12 @@ javadoc {
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar) {
classifier = "javadoc"
archiveClassifier = 'javadoc'
from javadoc
}

Expand Down
Loading

0 comments on commit 1a0e26a

Please sign in to comment.