11name : rollbar-java CI
22on :
3+ workflow_call :
4+ secrets :
5+ RELEASE_GPG_PRIVATE_KEY :
6+ required : true
7+ RELEASE_GPG_PRIVATE_KEY_PASSPHRASE :
8+ required : true
9+ NEXUS_USERNAME :
10+ required : true
11+ NEXUS_PASSWORD :
12+ required : true
313 push :
4- branches : [master]
14+ branches : [ master ]
515 pull_request :
6- branches : [master]
16+ branches : [ master ]
17+
718
819jobs :
20+ validation :
21+ name : Gradle wrapper validation
22+ runs-on : ubuntu-20.04
23+ steps :
24+ - uses : actions/checkout@v4
25+ - uses : gradle/actions/wrapper-validation@v3
26+
927 build :
1028 runs-on : ubuntu-20.04
11- name : Java ${{ matrix.java }}
29+ name : Build with Java ${{ matrix.java }}
30+ needs : [ validation ]
1231 strategy :
32+ fail-fast : false
1333 matrix :
14- java : [8, 11]
34+ # Must upgrade Gradle before we can go past Java 15 here.
35+ # https://docs.gradle.org/current/userguide/compatibility.html
36+ java : [ 8, 11 ]
1537 steps :
16- - uses : actions/checkout@v2
38+ - uses : actions/checkout@v4
1739
1840 - name : Fetch git tags
19- run : ./.github/fetch_to_tag.sh
20-
21- # Our build uses JDK7's rt.jar to make sure the artifact is fully
22- # compatible with Java 7, so we let this action set Java 7 up for us
23- # and we store its JAVA_HOME
24- - name : Set up Java 7
25- uses : actions/setup-java@v1
26- with :
27- java-version : 7
28-
29- - name : Capture JDK7_HOME
30- run : echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home
41+ run : ./.github/scripts/fetch_to_tag.sh
3142
32- - name : Set up Java 17 (needed for Spring Boot 3)
33- uses : actions/setup-java@v1
34- with :
35- java-version : 17
36-
37- - name : Capture JDK17_HOME
38- run : echo "export JDK17_HOME=\"$JAVA_HOME\"" > ~/.jdk17_home
39-
40- # This is the JDK that'll run the build
4143 - name : Set up Java ${{ matrix.java }}
42- uses : actions/setup-java@v1
44+ uses : actions/setup-java@v4
4345 with :
4446 java-version : ${{ matrix.java }}
47+ distribution : ' zulu'
48+ cache : ' gradle'
4549
46- - name : Cache Gradle packages
47- uses : actions/cache@v2
48- with :
49- path : |
50- ~/.gradle/caches
51- ~/.gradle/wrapper
52- key : ${{ runner.os }}-gradle-${{ matrix.java }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
53- restore-keys : |
54- ${{ runner.os }}-gradle-${{ matrix.java }}-
50+ # gradle/actions/setup-gradle@v3 might offer better caching and other benefits through better integration.
51+ # https://github.com/gradle/actions/blob/main/docs/setup-gradle.md
5552
5653 - name : Environment info
5754 run : |
@@ -63,26 +60,26 @@ jobs:
6360 echo ANDROID_SDK_ROOT: ${ANDROID_SDK_ROOT}
6461
6562 - name : Build
66- run : ' source ~/.jdk7_home && . /gradlew clean build'
63+ run : . /gradlew clean build
6764
68- - name : Check
69- run : ' source ~/.jdk7_home && ./gradlew clean check'
70-
71- - name : Cleanup Gradle cache
72- # Recommended by https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle
73- run : |
74- rm -f ~/.gradle/caches/modules-2/modules-2.lock
75- rm -f ~/.gradle/caches/modules-2/gc.properties
65+ - name : Upload build reports
66+ if : always()
67+ uses : actions/upload-artifact@v4
68+ with :
69+ name : java-${{ matrix.java }}-build-reports
70+ path : |
71+ **/build/reports/*
7672
7773 release :
7874 runs-on : ubuntu-20.04
75+ name : Release
7976 # It would be nice to run this as part of the build job, since it would be
8077 # faster and have less duplicated Yaml, it would not be possible to check
8178 # for all matrix results before publishing if this were just another step
8279 # in that job.
83- needs : build
80+ needs : [ build ]
8481 steps :
85- - uses : actions/checkout@v2
82+ - uses : actions/checkout@v4
8683
8784 - name : Set up Java 11 for the Android SDK Manager
8885 uses : actions/setup-java@v1
@@ -94,47 +91,18 @@ jobs:
9491 echo "Android SDK Manager version: `${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --version`"
9592 ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "platforms;android-27" "build-tools;28.0.3"
9693
97- - name : Set up Java 7
98- uses : actions/setup-java@v1
99- with :
100- java-version : 7
101-
102- - name : Capture JDK7_HOME
103- run : echo "export JDK7_HOME=\"$JAVA_HOME\"" > ~/.jdk7_home
104-
105- - name : Set up Java 8
106- uses : actions/setup-java@v1
94+ - name : Set up Java 8 for the build
95+ uses : actions/setup-java@v4
10796 with :
10897 java-version : 8
109-
110- - name : Cache Gradle packages
111- uses : actions/cache@v2
112- with :
113- path : |
114- ~/.gradle/caches
115- ~/.gradle/wrapper
116- key : ${{ runner.os }}-gradle-8-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
117- restore-keys : |
118- ${{ runner.os }}-gradle-8-
98+ distribution : ' zulu'
99+ cache : ' gradle'
119100
120101 - name : Release
121102 env :
122- SECRING_GPG_IV : ${{ secrets.SECRING_GPG_IV }}
123- SECRING_GPG_KEY : ${{ secrets.SECRING_GPG_KEY }}
124- GPG_KEY_ID : ${{ secrets.GPG_KEY_ID }}
125- GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
126- ENCRYPTED_GPG_KEY_LOCATION : ./.github/secring.gpg.enc
127- GPG_KEY_LOCATION : ./.github/secring.gpg
103+ RELEASE_GPG_PRIVATE_KEY : ${{ secrets.RELEASE_GPG_PRIVATE_KEY }}
104+ RELEASE_GPG_PRIVATE_KEY_PASSPHRASE : ${{ secrets.RELEASE_GPG_PRIVATE_KEY_PASSPHRASE }}
128105 NEXUS_USERNAME : ${{ secrets.NEXUS_USERNAME }}
129106 NEXUS_PASSWORD : ${{ secrets.NEXUS_PASSWORD }}
130107 run : |
131- if test "$GITHUB_REPOSITORY" = "rollbar/rollbar-java" -a "$GITHUB_BASE_REF" = ""; then
132- openssl enc -aes-256-cbc -K "$SECRING_GPG_KEY" -iv "$SECRING_GPG_IV" -in "$ENCRYPTED_GPG_KEY_LOCATION" -out "$GPG_KEY_LOCATION" -d
133- fi &&
134- source ~/.jdk7_home &&
135- ./.github/release.sh
136-
137- - name : Cleanup Gradle cache
138- run : |
139- rm -f ~/.gradle/caches/modules-2/modules-2.lock
140- rm -f ~/.gradle/caches/modules-2/gc.properties
108+ ./gradlew -Dorg.gradle.internal.http.socketTimeout=300000 -Dorg.gradle.internal.http.connectionTimeout=300000 publishToSonatype
0 commit comments