Skip to content
Permalink
Browse files
Use Github actions matrix build
This allows us to verify that the MR-Jar works across various
JVMs by running the unit test suite across each Java version.
  • Loading branch information
davecromberge committed Jun 17, 2021
1 parent 5af68db commit 3e90f64cc71936da926c93478dd95b513e5c3dac
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 66 deletions.
@@ -3,41 +3,31 @@
<toolchain>
<type>jdk</type>
<provides>
<version>8</version>
<vendor>adoptopenjdk</vendor>
<version>1.8</version>
<vendor>openjdk</vendor>
</provides>
<configuration>
<jdkHome>${JAVA_HOME}</jdkHome>
<jdkHome>${env.JAVA8_HOME}</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>11</version>
<vendor>adoptopenjdk</vendor>
</provides>
<configuration>
<jdkHome>${env.JAVA11_HOME}</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>15</version>
<vendor>adoptopenjdk</vendor>
<version>8</version>
<vendor>openjdk</vendor>
</provides>
<configuration>
<jdkHome>${env.JAVA15_HOME}</jdkHome>
<jdkHome>${env.JAVA8_HOME}</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>16</version>
<vendor>adoptopenjdk</vendor>
<version>11</version>
<vendor>openjdk</vendor>
</provides>
<configuration>
<jdkHome>${env.JAVA16_HOME}</jdkHome>
<jdkHome>${env.JAVA11_HOME}</jdkHome>
</configuration>
</toolchain>
</toolchains>
@@ -1,54 +1,97 @@
name: Java Test Coverage with Maven, Coveralls

on:
pull_request:
push:
branches: [ master ]
workflow_dispatch:
pull_request:
push:
branches: [ master ]
workflow_dispatch:

env:
MAVEN_OPTS: -Xmx4g -Xms1g
repo_token: ${{secrets.coveralls_token}}
MAVEN_OPTS: -Xmx4g -Xms1g
repo_token: ${{secrets.coveralls_token}}
RUNNER_TEMP: /tmp

jobs:
build:
name: Build, Test, Coverage
runs-on: ubuntu-latest

steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: build-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: build-${{ runner.os }}-maven-

- name: Install JDK
uses: AdoptOpenJDK/install-jdk@v1
with:
version: '8'
architecture: x64
impl: hotspot
targets: 'JDK_8;JAVA_HOME'

- name: Install Dependencies
run: >
mvn clean install -B -V -q
-DskipTests=true
-Dmaven.javadoc.skip=true
-Dgpg.skip=true
--toolchains .github/workflows/.toolchains.xml
- name: Test & Report
if: ${{ success() }}
run: >
mvn verify coveralls:report -B -V -q
-Dcoveralls-repo-token=${repo_token}
-Dmaven.javadoc.skip=true
-Dgpg.skip=true
--toolchains .github/workflows/.toolchains.xml
build:
name: Build, Test, Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jdk: [8,9,11]

env:
JDK_VERSION: ${{ matrix.jdk }}

steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: build-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: build-${{ runner.os }}-maven-

- name: Install JDK 8
uses: AdoptOpenJDK/install-jdk@v1
with:
version: '8'
architecture: x64
impl: hotspot
targets: 'JAVA8_HOME'

- name: Install JDK 9
uses: AdoptOpenJDK/install-jdk@v1
with:
version: '9'
architecture: x64
impl: hotspot
targets: 'JAVA9_HOME'

- name: Install JDK 11
uses: AdoptOpenJDK/install-jdk@v1
with:
version: '11'
architecture: x64
impl: hotspot
targets: 'JAVA11_HOME'

- name: Install Matrix JDK
uses: AdoptOpenJDK/install-jdk@v1
with:
version: ${{ matrix.jdk }}
architecture: x64
impl: hotspot
targets: 'JAVA_HOME'

- name: Echo Java Version
run: >
java -version
- name: Install Dependencies
run: >
mvn clean install
-DskipTests=true
-Dmaven.javadoc.skip=true
-Dgpg.skip=true
--toolchains .github/workflows/.toolchains.xml
- name: Package
run: >
mvn package
-Dmaven.javadoc.skip=true
-Dgpg.skip=true
--toolchains .github/workflows/.toolchains.xml
- name: Test & Report
if: ${{ matrix.jdk == 8 && success() }}
run: >
mvn verify coveralls:report -B -V
-Dcoveralls-repo-token=${repo_token}
-Dmaven.javadoc.skip=true
-Dgpg.skip=true
--toolchains .github/workflows/.toolchains.xml

0 comments on commit 3e90f64

Please sign in to comment.