Skip to content

Commit f82a458

Browse files
committed
Update CI for Multi-Release JAR builds
Split CI into build (JDK 11) and test (JDK 8/11/17) jobs to support module compilation while maintaining compatibility testing.
1 parent 00e8957 commit f82a458

File tree

1 file changed

+43
-11
lines changed

1 file changed

+43
-11
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ on:
99
- main
1010

1111
jobs:
12-
test:
13-
name: "JDK ${{ matrix.java }}"
14-
strategy:
15-
matrix:
16-
java: [ 8, 11, 17 ]
12+
build:
13+
name: "Build with JDK 11"
1714
runs-on: ubuntu-latest
1815
steps:
1916
# Cancel any previous runs for the same branch that are still running.
@@ -30,21 +27,56 @@ jobs:
3027
key: maven-${{ hashFiles('**/pom.xml') }}
3128
restore-keys: |
3229
maven-
30+
- name: 'Set up JDK 11'
31+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
32+
with:
33+
java-version: 11
34+
distribution: 'zulu'
35+
- name: 'Build Multi-Release JAR'
36+
shell: bash
37+
run: mvn -B process-test-classes -U -f build-pom.xml
38+
- name: 'Upload build artifacts'
39+
uses: actions/upload-artifact@v3
40+
with:
41+
name: build-artifacts
42+
path: |
43+
**/target/classes/
44+
**/target/*.jar
45+
retention-days: 1
46+
47+
test:
48+
name: "Test on JDK ${{ matrix.java }}"
49+
strategy:
50+
matrix:
51+
java: [ 8, 11, 17 ]
52+
runs-on: ubuntu-latest
53+
needs: build
54+
steps:
55+
- name: 'Check out repository'
56+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
57+
- name: 'Cache local Maven repository'
58+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809
59+
with:
60+
path: ~/.m2/repository
61+
key: maven-${{ hashFiles('**/pom.xml') }}
62+
restore-keys: |
63+
maven-
64+
- name: 'Download build artifacts'
65+
uses: actions/download-artifact@v3
66+
with:
67+
name: build-artifacts
3368
- name: 'Set up JDK ${{ matrix.java }}'
3469
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
3570
with:
3671
java-version: ${{ matrix.java }}
3772
distribution: 'zulu'
38-
- name: 'Install'
39-
shell: bash
40-
run: mvn -B dependency:go-offline test clean -U --quiet --fail-never -DskipTests=true -f build-pom.xml
4173
- name: 'Test'
4274
shell: bash
43-
run: mvn -B verify -U --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true -f build-pom.xml
75+
run: mvn -B test -U --fail-at-end -f build-pom.xml
4476

4577
publish_snapshot:
4678
name: 'Publish snapshot'
47-
needs: test
79+
needs: [build, test]
4880
if: github.event_name == 'push' && github.repository == 'google/auto'
4981
runs-on: ubuntu-latest
5082
steps:
@@ -75,7 +107,7 @@ jobs:
75107
permissions:
76108
contents: write
77109
name: 'Generate latest docs'
78-
needs: test
110+
needs: [build, test]
79111
if: github.event_name == 'push' && github.repository == 'google/auto'
80112
runs-on: ubuntu-latest
81113
steps:

0 commit comments

Comments
 (0)