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

Drop JDK 7 and fix CI build #315

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
306f3d6
Remove JDK 7 target
csaba-ilonka-rollbar Aug 3, 2024
3c9a910
Bump `actions/checkout` to `v4`
csaba-ilonka-rollbar Aug 3, 2024
a756bc2
Bump Android Gradle Plugin to `v4`
csaba-ilonka-rollbar Aug 3, 2024
262ba51
Experimental workflow simplification.
csaba-ilonka-rollbar Aug 3, 2024
6137719
Fix `actions/setup-java`
csaba-ilonka-rollbar Aug 3, 2024
8cf6c28
Bump Android build tools version to match the Android Gradle Plugin r…
csaba-ilonka-rollbar Aug 3, 2024
015ffbd
Refactor root/submodule build configs.
csaba-ilonka-rollbar Aug 3, 2024
52d5d60
Move scripts.
csaba-ilonka-rollbar Aug 3, 2024
2c34542
Refactoring.
csaba-ilonka-rollbar Aug 3, 2024
7b2c859
Upload build reports.
csaba-ilonka-rollbar Aug 3, 2024
0829052
Fix bad shell command
csaba-ilonka-rollbar Aug 3, 2024
25e36e8
Turn of matrix strategy fail-fast
csaba-ilonka-rollbar Aug 3, 2024
8bb8906
Fix SDK Manager path
csaba-ilonka-rollbar Aug 3, 2024
2bad8a5
Attempt to upload build artifacts even on failed build.
csaba-ilonka-rollbar Aug 3, 2024
5990c88
Distinguish uploaded artifacts in matrix strategy.
csaba-ilonka-rollbar Aug 3, 2024
b6c22e1
Remove incompatible Java versions from the build matrix.
csaba-ilonka-rollbar Aug 3, 2024
5400f4e
Bump Android build tools version to 31
csaba-ilonka-rollbar Aug 7, 2024
84037ff
Try a SNAPSHOT release
csaba-ilonka-rollbar Aug 7, 2024
4eb3fb1
Oups
csaba-ilonka-rollbar Aug 7, 2024
69d3841
Oups 2
csaba-ilonka-rollbar Aug 7, 2024
a734f20
Android `dx` vs `d8`
csaba-ilonka-rollbar Aug 7, 2024
15e91e4
Use the SDK manager to install required packages.
csaba-ilonka-rollbar Aug 8, 2024
2153208
Remove Java 15 from the build matrix.
csaba-ilonka-rollbar Aug 8, 2024
151f32f
Fix typo
csaba-ilonka-rollbar Aug 8, 2024
7afa0b2
Refactoring.
csaba-ilonka-rollbar Aug 8, 2024
73a75f2
Print OpenSSL version.
csaba-ilonka-rollbar Aug 8, 2024
a1be39d
Downgrade runner to Ubuntu 20.04 that packs OpenSSL v1
csaba-ilonka-rollbar Aug 8, 2024
6ff60bd
Check OpenSSL variables
csaba-ilonka-rollbar Aug 8, 2024
84c6dec
Refresh signing key.
csaba-ilonka-rollbar Aug 12, 2024
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
File renamed without changes.
2 changes: 0 additions & 2 deletions .github/release.sh → .github/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ elif [[ -z $VERSION ]]; then
elif ! [[ $VERSION =~ $SEMVER_REGEX ]]; then
echo "Skipping release. Bad version used."
else
# Gradle needs the absolute path to the secring
export GPG_KEY_LOCATION="$(realpath "$GPG_KEY_LOCATION")"

if [[ ${BASH_REMATCH[5]} == 'SNAPSHOT' ]]; then
echo "Doing SNAPSHOT release..."
Expand Down
144 changes: 62 additions & 82 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,130 +1,110 @@
name: rollbar-java CI
on:
workflow_call:
secrets:
RELEASE_GPG_PRIVATE_KEY:
required: true
RELEASE_GPG_PRIVATE_KEY_PASSPHRASE:
required: true
NEXUS_USERNAME:
required: true
NEXUS_PASSWORD:
required: true
push:
branches: [master]
branches: [ master ]
pull_request:
branches: [master]
branches: [ master ]


jobs:
validation:
name: Gradle wrapper validation
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3

build:
runs-on: ubuntu-20.04
name: Java ${{ matrix.java }}
name: Build with Java ${{ matrix.java }}
needs: [ validation ]
strategy:
fail-fast: false
matrix:
java: [8, 11]
# Must upgrade Gradle before we can go past Java 15 here.
# https://docs.gradle.org/current/userguide/compatibility.html
java: [ 8, 11 ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Fetch git tags
run: ./.github/fetch_to_tag.sh

# Our build uses JDK7's rt.jar to make sure the artifact is fully
# compatible with Java 7, so we let this action set Java 7 up for us
# and we store its JAVA_HOME
- name: Set up Java 7
uses: actions/setup-java@v1
with:
java-version: 7
run: ./.github/scripts/fetch_to_tag.sh

- name: Capture JDK7_HOME
run: echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home

- name: Set up Java 17 (needed for Spring Boot 3)
uses: actions/setup-java@v1
with:
java-version: 17

- name: Capture JDK17_HOME
run: echo "export JDK17_HOME=\"$JAVA_HOME\"" > ~/.jdk17_home

# This is the JDK that'll run the build
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
cache: 'gradle'

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ matrix.java }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-${{ matrix.java }}-
# gradle/actions/setup-gradle@v3 might offer better caching and other benefits through better integration.
# https://github.com/gradle/actions/blob/main/docs/setup-gradle.md

- name: Environment info
run: |
./gradlew --version
echo ANDROID_SDK_ROOT: ${ANDROID_SDK_ROOT}
${ANDROID_SDK_ROOT}/tools/bin/sdkmanager --version
echo JAVA_HOME: ${JAVA_HOME}
java -version
javac -version
echo ANDROID_HOME: ${ANDROID_HOME}
echo ANDROID_SDK_ROOT: ${ANDROID_SDK_ROOT}

- name: Build
run: 'source ~/.jdk7_home && ./gradlew clean build'

- name: Check
run: 'source ~/.jdk7_home && ./gradlew clean check'
run: ./gradlew clean build

- name: Cleanup Gradle cache
# Recommended by https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Upload build reports
if: always()
uses: actions/upload-artifact@v4
with:
name: java-${{ matrix.java }}-build-reports
path: |
**/build/reports/*

release:
runs-on: ubuntu-20.04
name: Release
# It would be nice to run this as part of the build job, since it would be
# faster and have less duplicated Yaml, it would not be possible to check
# for all matrix results before publishing if this were just another step
# in that job.
needs: build
needs: [ build ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Java 7
uses: actions/setup-java@v1
- name: Set up Java 11 for the Android SDK Manager
uses: actions/setup-java@v4
with:
java-version: 7
java-version: 11
distribution: 'zulu'
cache: 'gradle'

- name: Capture JDK7_HOME
run: echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home
- name: Install Android SDK
run: |
echo "Android SDK Manager version: `${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --version`"
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "platforms;android-27" "build-tools;30.0.3"

- name: Set up Java 8
uses: actions/setup-java@v1
- name: Set up Java 8 for the build
uses: actions/setup-java@v4
with:
java-version: 8

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-8-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-8-
distribution: 'zulu'
cache: 'gradle'

- name: Release
env:
SECRING_GPG_IV: ${{ secrets.SECRING_GPG_IV }}
SECRING_GPG_KEY: ${{ secrets.SECRING_GPG_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
ENCRYPTED_GPG_KEY_LOCATION: ./.github/secring.gpg.enc
GPG_KEY_LOCATION: ./.github/secring.gpg
RELEASE_GPG_PRIVATE_KEY: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }}
RELEASE_GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.RELEASE_GPG_PRIVATE_KEY_PASSPHRASE }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
if test "$GITHUB_REPOSITORY" = "rollbar/rollbar-java" -a "$GITHUB_BASE_REF" = ""; then
openssl enc -aes-256-cbc -K "$SECRING_GPG_KEY" -iv "$SECRING_GPG_IV" -in "$ENCRYPTED_GPG_KEY_LOCATION" -out "$GPG_KEY_LOCATION" -d
fi &&
source ~/.jdk7_home &&
./.github/release.sh

- name: Cleanup Gradle cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
./gradlew -Dorg.gradle.internal.http.socketTimeout=300000 -Dorg.gradle.internal.http.connectionTimeout=300000 publishToSonatype
10 changes: 0 additions & 10 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

22 changes: 6 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}

subprojects { project ->
if (!project.name.contains('android') &&
!project.parent.name.equals("examples") &&
!project.name.contains('examples')) {
if (!project.name.contains('android') && !project.parent.name.equals("examples") && !project.name.contains('examples')) {
apply plugin: 'java-library'

apply from: "$rootDir/gradle/release.gradle"
Expand Down Expand Up @@ -63,23 +60,16 @@ subprojects { project ->
}

compileJava {
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_9) >= 0) {
// Use the --release javac flag, available since JDK9, which is equivalent to setting
// the source, target, and bootstrap classpath, and catches all usages of stdlib
// features not available in the target version.
options.release = 7
if (JavaVersion.current().isJava9Compatible()) {
options.release = 8
} else {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

if (System.env.JDK7_HOME) {
options.bootstrapClasspath = files("${System.env.JDK7_HOME}/jre/lib/rt.jar")
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

compileTestJava {
if (JavaVersion.current().compareTo(JavaVersion.VERSION_1_9) >= 0) {
if (JavaVersion.current().isJava9Compatible()) {
options.release = 8
} else {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
7 changes: 4 additions & 3 deletions examples/rollbar-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.android.tools.build:gradle:4.2.2'
}
}

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "28.0.3"
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.rollbar.example.android"
minSdkVersion 16
// FIXME: Pending further discussion
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 27
versionCode 1
versionName "1.0"
Expand Down
6 changes: 5 additions & 1 deletion examples/rollbar-spring-boot3-webmvc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ plugins {

group = 'com.rollbar.example'
version = VERSION_NAME
sourceCompatibility = '17'

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
mavenLocal()
Expand Down
2 changes: 1 addition & 1 deletion examples/rollbar-spring-webmvc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion examples/rollbar-struts2-spring/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion examples/rollbar-struts2/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion examples/rollbar-web/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.10.1-SNAPSHOT
VERSION_NAME=1.10.2-SNAPSHOT-2024070701
GROUP=com.rollbar

POM_DESCRIPTION=For connecting your applications built on the JVM to Rollbar for Error Reporting
Expand Down
21 changes: 8 additions & 13 deletions gradle/release.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apply plugin: 'signing'
apply plugin: 'maven-publish'


apply plugin: "de.marcphilipp.nexus-publish"

nexusPublishing {
repositories {
sonatype {
Expand All @@ -12,16 +11,6 @@ nexusPublishing {
}
}

gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
allprojects {
ext."signing.keyId" = System.getenv("GPG_KEY_ID")
ext."signing.secretKeyRingFile" = System.getenv("GPG_KEY_LOCATION")
ext."signing.password" = System.getenv("GPG_PASSPHRASE")
}
}
}

afterEvaluate {
if (project.parent != null && !project.parent.name.equals("examples") && !project.name.contains('examples')) {
if (!project.hasProperty('android')) {
Expand Down Expand Up @@ -93,6 +82,9 @@ afterEvaluate {

signing {
required true
useInMemoryPgpKeys(
findProperty("signingKey") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY"),
findProperty("signingPassword") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY_PASSPHRASE"))
sign publishing.publications.maven
}
}
Expand Down Expand Up @@ -147,7 +139,7 @@ afterEvaluate {
name = POM_NAME
description = POM_DESCRIPTION
url = POM_URL

scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
Expand Down Expand Up @@ -175,6 +167,9 @@ afterEvaluate {
}
signing {
required true
useInMemoryPgpKeys(
findProperty("signingKey") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY"),
findProperty("signingPassword") ?: System.getenv("RELEASE_GPG_PRIVATE_KEY_PASSPHRASE"))
sign publishing.publications.release
}
}
Expand Down
Loading
Loading