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

chore: add java21 support #299

Merged
merged 2 commits into from
Sep 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
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