Skip to content

Commit

Permalink
CI: Update Workflows (#1879)
Browse files Browse the repository at this point in the history
* Update Workflows

#1875

* Updated requested changes
  • Loading branch information
ohbus committed Oct 27, 2021
1 parent bee1283 commit 72bb189
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 22 deletions.
49 changes: 35 additions & 14 deletions .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -47,27 +49,21 @@ 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:
path: ~/.sonar/cache
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
Expand All @@ -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
11 changes: 3 additions & 8 deletions .github/workflows/maven-pr-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 72bb189

Please sign in to comment.