From d9ceaa38e4c11f6b826eec72e08930741e77c202 Mon Sep 17 00:00:00 2001 From: "David M. Lloyd" Date: Wed, 6 Dec 2023 07:32:13 -0600 Subject: [PATCH] Use multi-JDK support for testing, configurable Maven version --- .github/workflows/build.yml | 87 +++++++++---------------------------- 1 file changed, 20 insertions(+), 67 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5514e437..6833587d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,7 @@ name: SmallRye Build +env: + MAVEN_VERSION: 3.8.3 + IO_TAKARI_MAVEN_WRAPPER_VERSION: 0.7.7 on: push: @@ -20,74 +23,24 @@ on: - 'README*' jobs: - build-linux: - runs-on: ubuntu-latest + build: strategy: matrix: - java: [ 11, 17 ] - name: build with JDK ${{matrix.java}} (Linux) - - steps: - - uses: actions/checkout@v4 - name: checkout - - - uses: AdoptOpenJDK/install-jdk@v1 - name: set up JDK ${{matrix.java}} - with: - version: ${{matrix.java}} - - - name: Cache local Maven repository - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - - name: build with maven - run: | - mvn -q -N io.takari:maven:0.7.7:wrapper -Dmaven=3.8.3 - ./mvnw -B formatter:validate verify --file pom.xml - - build-windows: - runs-on: windows-latest - name: build with JDK 11 (Windows) - - steps: - - uses: actions/checkout@v4 - name: checkout - - - uses: AdoptOpenJDK/install-jdk@v1 - name: set up JDK 11 - with: - version: 11 - - - name: Cache local Maven repository - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - - name: build with maven - shell: bash - run: | - mvn -q -N io.takari:maven:0.7.7:wrapper -Dmaven=3.8.3 - ./mvnw -B formatter:validate verify --file pom.xml - - build-macos: - runs-on: macos-latest - name: build with JDK 11 (Mac OS) + os: [ ubuntu-latest, windows-latest, macos-latest ] + runs-on: ${{ matrix.os }} + name: build steps: - uses: actions/checkout@v4 name: checkout - - uses: AdoptOpenJDK/install-jdk@v1 - name: set up JDK 11 + - uses: actions/setup-java@v3 + name: set up JDKs with: - version: 11 + distribution: temurin + java-version: | + 11 + 17 - name: Cache local Maven repository uses: actions/cache@v3 @@ -99,20 +52,20 @@ jobs: - name: build with maven run: | - mvn -q -N io.takari:maven:0.7.7:wrapper -Dmaven=3.8.3 - ./mvnw -B formatter:validate verify --file pom.xml + mvn -q -N "io.takari:maven:${{env.IO_TAKARI_MAVEN_WRAPPER_VERSION}}:wrapper" "-Dmaven=${{env.MAVEN_VERSION}}" + ./mvnw -B -ntp formatter:validate verify --file pom.xml "-Djava11.home=${{env.JAVA_HOME_11_X64}}" quality: - needs: [build-linux,build-macos,build-windows] + needs: [ build ] if: github.event_name == 'push' && github.repository_owner == 'smallrye' runs-on: ubuntu-latest name: quality steps: - uses: actions/checkout@v4 - - uses: AdoptOpenJDK/install-jdk@v1 + - uses: actions/setup-java@v3 with: - version: 11 + java-version: 11 - name: Cache local Maven repository uses: actions/cache@v3 @@ -127,5 +80,5 @@ jobs: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} run: | - mvn -q -N io.takari:maven:0.7.7:wrapper -Dmaven=3.8.3 - ./mvnw -B javadoc:javadoc verify --file pom.xml -Pcoverage sonar:sonar -Dsonar.projectKey=smallrye_smallrye-common -Dsonar.login=$SONAR_TOKEN + mvn -q -N "io.takari:maven:${{env.IO_TAKARI_MAVEN_WRAPPER_VERSION}}:wrapper" "-Dmaven=${{env.MAVEN_VERSION}}" + ./mvnw -B -ntp javadoc:javadoc verify --file pom.xml -Pcoverage sonar:sonar -Dsonar.projectKey=smallrye_smallrye-common -Dsonar.login=$SONAR_TOKEN