Skip to content

Commit e6aaf16

Browse files
committed
Test Java 8 in parallel
1 parent 2822729 commit e6aaf16

File tree

2 files changed

+104
-133
lines changed

2 files changed

+104
-133
lines changed

.github/workflows/maven-build.yml

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,44 @@ permissions:
1919

2020
jobs:
2121
build:
22-
name: build-only (Java ${{ matrix.java }})
22+
name: build-only (Java 17)
2323
runs-on: ubuntu-latest
2424
strategy:
25-
fail-fast: false
26-
matrix:
27-
java: [ 17 ]
25+
fail-fast: true
2826
steps:
29-
- uses: actions/checkout@v3
30-
- name: Set up JDK
31-
uses: actions/setup-java@v3
32-
with:
33-
java-version: ${{ matrix.java }}
34-
distribution: 'temurin'
35-
cache: 'maven'
36-
- name: Maven Install (skipTests)
37-
env:
38-
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
39-
run: mvn -B clean install -DskipTests --file pom.xml
27+
- uses: actions/checkout@v3
28+
- name: Set up JDK
29+
uses: actions/setup-java@v3
30+
with:
31+
java-version: 17
32+
distribution: 'temurin'
33+
cache: 'maven'
34+
- name: Maven Install (skipTests)
35+
env:
36+
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
37+
run: mvn -B clean install -DskipTests --file pom.xml
38+
- uses: actions/upload-artifact@v3
39+
with:
40+
name: maven-target-directory
41+
path: target/
42+
retention-days: 3
4043
site:
41-
name: site (Java ${{ matrix.java }})
44+
name: site (Java 17)
4245
runs-on: ubuntu-latest
4346
strategy:
4447
fail-fast: false
45-
matrix:
46-
java: [ 17 ]
4748
steps:
48-
- uses: actions/checkout@v3
49-
- name: Set up JDK
50-
uses: actions/setup-java@v3
51-
with:
52-
java-version: ${{ matrix.java }}
53-
distribution: 'temurin'
54-
cache: 'maven'
55-
- name: Maven Site
56-
env:
57-
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
58-
run: mvn -B clean site -D enable-ci --file pom.xml
49+
- uses: actions/checkout@v3
50+
- name: Set up JDK
51+
uses: actions/setup-java@v3
52+
with:
53+
java-version: 17
54+
distribution: 'temurin'
55+
cache: 'maven'
56+
- name: Maven Site
57+
env:
58+
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
59+
run: mvn -B clean site -D enable-ci --file pom.xml
5960
test:
6061
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
6162
runs-on: ${{ matrix.os }}-latest
@@ -86,13 +87,22 @@ jobs:
8687
- name: Codecov Report
8788
if: matrix.os == 'ubuntu' && matrix.java == '17'
8889
uses: codecov/[email protected]
90+
91+
test-java-8:
92+
name: test Java 8 (no-build)
93+
needs: build
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v3
97+
- uses: actions/download-artifact@v3
98+
with:
99+
name: maven-target-directory
100+
path: target
89101
- name: Set up JDK
90-
if: matrix.os == 'ubuntu' && matrix.java == '17'
91102
uses: actions/setup-java@v3
92103
with:
93104
java-version: 8
94105
distribution: 'temurin'
95-
cache: 'maven'
106+
cache: 'maven'
96107
- name: Maven Test (no build) Java 8
97-
if: matrix.os == 'ubuntu' && matrix.java == '17'
98-
run: mvn -B surefire:test -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt
108+
run: mvn -B surefire:test -DfailIfNoTests -Dsurefire.excludesFile=src/test/resources/slow-or-flaky-tests.txt

pom.xml

Lines changed: 61 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@
241241
<artifactId>java18</artifactId>
242242
<version>1.0</version>
243243
</signature>
244+
<ignores>
245+
java.net.http.*
246+
</ignores>
244247
</configuration>
245248
<executions>
246249
<execution>
@@ -301,6 +304,24 @@
301304
</annotationProcessorPath>
302305
</annotationProcessorPaths>
303306
</configuration>
307+
<executions>
308+
<execution>
309+
<id>compile-java-11</id>
310+
<phase>compile</phase>
311+
<goals>
312+
<goal>compile</goal>
313+
</goals>
314+
<configuration>
315+
<release>11</release>
316+
<source>11</source>
317+
<target>11</target>
318+
<compileSourceRoots>
319+
<compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
320+
</compileSourceRoots>
321+
<multiReleaseOutput>true</multiReleaseOutput>
322+
</configuration>
323+
</execution>
324+
</executions>
304325
</plugin>
305326
<plugin>
306327
<artifactId>maven-surefire-plugin</artifactId>
@@ -316,6 +337,19 @@
316337
</execution>
317338
</executions>
318339
</plugin>
340+
<plugin>
341+
<groupId>org.apache.maven.plugins</groupId>
342+
<artifactId>maven-jar-plugin</artifactId>
343+
<version>3.3.0</version>
344+
<configuration>
345+
<archive>
346+
<manifestEntries>
347+
<Automatic-Module-Name>org.kohsuke.github.api</Automatic-Module-Name>
348+
<Multi-Release>true</Multi-Release>
349+
</manifestEntries>
350+
</archive>
351+
</configuration>
352+
</plugin>
319353
<plugin>
320354
<groupId>org.codehaus.mojo</groupId>
321355
<artifactId>animal-sniffer-maven-plugin</artifactId>
@@ -618,7 +652,7 @@
618652
<profiles>
619653
<!-- only enable slow-or-flaky-test if -Dtest= is not present -->
620654
<profile>
621-
<id>slow-or-flaky-test</id>
655+
<id>test-slow-multireleasejar-flaky</id>
622656
<activation>
623657
<property>
624658
<name>!test</name>
@@ -641,6 +675,32 @@
641675
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=okhttp</argLine>
642676
</configuration>
643677
</execution>
678+
<execution>
679+
<id>java11-test</id>
680+
<phase>integration-test</phase>
681+
<goals>
682+
<goal>test</goal>
683+
</goals>
684+
<configuration>
685+
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
686+
<useSystemClassLoader>false</useSystemClassLoader>
687+
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
688+
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=httpclient</argLine>
689+
</configuration>
690+
</execution>
691+
<execution>
692+
<id>java11-urlconnection-test</id>
693+
<phase>integration-test</phase>
694+
<goals>
695+
<goal>test</goal>
696+
</goals>
697+
<configuration>
698+
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
699+
<useSystemClassLoader>false</useSystemClassLoader>
700+
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
701+
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=urlconnection</argLine>
702+
</configuration>
703+
</execution>
644704
<execution>
645705
<id>slow-or-flaky-test</id>
646706
<phase>integration-test</phase>
@@ -783,105 +843,6 @@
783843
</plugins>
784844
</build>
785845
</profile>
786-
<profile>
787-
<id>multirelease</id>
788-
<activation>
789-
<jdk>[11,)</jdk>
790-
</activation>
791-
<build>
792-
<plugins>
793-
<plugin>
794-
<groupId>org.codehaus.mojo</groupId>
795-
<artifactId>animal-sniffer-maven-plugin</artifactId>
796-
<configuration>
797-
<ignores>
798-
java.net.http.*
799-
</ignores>
800-
</configuration>
801-
</plugin>
802-
<plugin>
803-
<artifactId>maven-compiler-plugin</artifactId>
804-
<version>3.10.1</version>
805-
<executions>
806-
<execution>
807-
<id>compile-java-11</id>
808-
<phase>compile</phase>
809-
<goals>
810-
<goal>compile</goal>
811-
</goals>
812-
<configuration>
813-
<release>11</release>
814-
<source>11</source>
815-
<target>11</target>
816-
<compileSourceRoots>
817-
<compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
818-
</compileSourceRoots>
819-
<multiReleaseOutput>true</multiReleaseOutput>
820-
</configuration>
821-
</execution>
822-
</executions>
823-
</plugin>
824-
<plugin>
825-
<groupId>org.apache.maven.plugins</groupId>
826-
<artifactId>maven-jar-plugin</artifactId>
827-
<version>3.3.0</version>
828-
<configuration>
829-
<archive>
830-
<manifestEntries>
831-
<Automatic-Module-Name>org.kohsuke.github.api</Automatic-Module-Name>
832-
<Multi-Release>true</Multi-Release>
833-
</manifestEntries>
834-
</archive>
835-
</configuration>
836-
</plugin>
837-
</plugins>
838-
</build>
839-
</profile>
840-
<profile>
841-
<id>multirelease-test</id>
842-
<activation>
843-
<jdk>[11,)</jdk>
844-
<property>
845-
<name>!test</name>
846-
</property>
847-
</activation>
848-
<build>
849-
<plugins>
850-
<plugin>
851-
<artifactId>maven-surefire-plugin</artifactId>
852-
<executions>
853-
<execution>
854-
<id>java11-test</id>
855-
<phase>integration-test</phase>
856-
<goals>
857-
<goal>test</goal>
858-
</goals>
859-
<configuration>
860-
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
861-
<useSystemClassLoader>false</useSystemClassLoader>
862-
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
863-
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=httpclient</argLine>
864-
</configuration>
865-
</execution>
866-
<execution>
867-
<id>java11-urlconnection-test</id>
868-
<phase>integration-test</phase>
869-
<goals>
870-
<goal>test</goal>
871-
</goals>
872-
<configuration>
873-
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
874-
<useSystemClassLoader>false</useSystemClassLoader>
875-
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
876-
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=urlconnection</argLine>
877-
</configuration>
878-
</execution>
879-
</executions>
880-
</plugin>
881-
</plugins>
882-
</build>
883-
</profile>
884-
885846
</profiles>
886847
<reporting>
887848
<plugins>

0 commit comments

Comments
 (0)