diff --git a/.github/workflows/maven-ci.yml b/.github/workflows/maven-ci.yml index 94406095e..3b1bcafb0 100644 --- a/.github/workflows/maven-ci.yml +++ b/.github/workflows/maven-ci.yml @@ -24,6 +24,9 @@ # This workflow will build a Java project with Maven # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# We are using two jobs here for testing our code on the latest JDK 11 build as well as a more satble build version of 11.0.3 +# You can see the full discussion here https://github.com/iluwatar/java-design-patterns/pull/1868#issue-1029459688 + name: Java CI on: @@ -33,12 +36,11 @@ on: jobs: - build: + # This Workflow Job will build this project and run Sonar analysis using JDK 11.0.3 + build-and-analyze: + name: Build and Run Sonar analysis on JDK 11.0.3 runs-on: ubuntu-20.04 - strategy: - matrix: - java-version: [ 11.0.3, 11 ] steps: - name: Checkout Code @@ -47,12 +49,14 @@ jobs: # Disabling shallow clone for improving relevancy of SonarQube reporting fetch-depth: 0 - - name: Set up JDK ${{ matrix.java-version }} + - name: Set up JDK 11.0.3 uses: actions/setup-java@v2 with: - java-version: ${{ matrix.java-version }} + java-version: 11.0.3 distribution: 'zulu' + cache: 'maven' + # Cache Sonar packages which as used to run anaylysis and collect metrics - name: Cache SonarCloud packages uses: actions/cache@v2 with: @@ -60,14 +64,6 @@ jobs: key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - name: Cache Maven dependencies - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - # Some tests need screen access - name: Install xvfb run: sudo apt-get install -y xvfb @@ -78,3 +74,28 @@ jobs: # These two env variables are needed for sonar analysis GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + + # This Workflow Job is going to build the project on the latest stable JDK 11 + build: + + name: Build and Test on JDK 11 + runs-on: ubuntu-20.04 + steps: + + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Set up JDK 11 (Latest) + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'zulu' + cache: 'maven' + + # Some tests need screen access + - name: Install xvfb + run: sudo apt-get install -y xvfb + + - name: Build with Maven + run: xvfb-run ./mvnw clean verify diff --git a/.github/workflows/maven-pr-builder.yml b/.github/workflows/maven-pr-builder.yml index c1fd2bd82..8e5c5d9c7 100644 --- a/.github/workflows/maven-pr-builder.yml +++ b/.github/workflows/maven-pr-builder.yml @@ -34,11 +34,13 @@ on: jobs: build: + name: Build JDP runs-on: ubuntu-20.04 strategy: matrix: java-version: [ 11.0.3, 11 ] steps: + - name: Checkout Code uses: actions/checkout@v2 @@ -47,14 +49,7 @@ jobs: with: java-version: ${{ matrix.java-version }} distribution: 'zulu' - - - name: Cache Maven Dependecies - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + cache: 'maven' # Some tests need screen access - name: Install xvfb