Skip to content

Commit 72bb189

Browse files
authored
CI: Update Workflows (iluwatar#1879)
* Update Workflows iluwatar#1875 * Updated requested changes
1 parent bee1283 commit 72bb189

File tree

2 files changed

+38
-22
lines changed

2 files changed

+38
-22
lines changed

.github/workflows/maven-ci.yml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
# This workflow will build a Java project with Maven
2525
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
2626

27+
# 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
28+
# You can see the full discussion here https://github.com/iluwatar/java-design-patterns/pull/1868#issue-1029459688
29+
2730
name: Java CI
2831

2932
on:
@@ -33,12 +36,11 @@ on:
3336

3437
jobs:
3538

36-
build:
39+
# This Workflow Job will build this project and run Sonar analysis using JDK 11.0.3
40+
build-and-analyze:
3741

42+
name: Build and Run Sonar analysis on JDK 11.0.3
3843
runs-on: ubuntu-20.04
39-
strategy:
40-
matrix:
41-
java-version: [ 11.0.3, 11 ]
4244
steps:
4345

4446
- name: Checkout Code
@@ -47,27 +49,21 @@ jobs:
4749
# Disabling shallow clone for improving relevancy of SonarQube reporting
4850
fetch-depth: 0
4951

50-
- name: Set up JDK ${{ matrix.java-version }}
52+
- name: Set up JDK 11.0.3
5153
uses: actions/setup-java@v2
5254
with:
53-
java-version: ${{ matrix.java-version }}
55+
java-version: 11.0.3
5456
distribution: 'zulu'
57+
cache: 'maven'
5558

59+
# Cache Sonar packages which as used to run anaylysis and collect metrics
5660
- name: Cache SonarCloud packages
5761
uses: actions/cache@v2
5862
with:
5963
path: ~/.sonar/cache
6064
key: ${{ runner.os }}-sonar
6165
restore-keys: ${{ runner.os }}-sonar
6266

63-
- name: Cache Maven dependencies
64-
uses: actions/cache@v2
65-
with:
66-
path: ~/.m2/repository
67-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
68-
restore-keys: |
69-
${{ runner.os }}-maven-
70-
7167
# Some tests need screen access
7268
- name: Install xvfb
7369
run: sudo apt-get install -y xvfb
@@ -78,3 +74,28 @@ jobs:
7874
# These two env variables are needed for sonar analysis
7975
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8076
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
77+
78+
79+
# This Workflow Job is going to build the project on the latest stable JDK 11
80+
build:
81+
82+
name: Build and Test on JDK 11
83+
runs-on: ubuntu-20.04
84+
steps:
85+
86+
- name: Checkout Code
87+
uses: actions/checkout@v2
88+
89+
- name: Set up JDK 11 (Latest)
90+
uses: actions/setup-java@v2
91+
with:
92+
java-version: 11
93+
distribution: 'zulu'
94+
cache: 'maven'
95+
96+
# Some tests need screen access
97+
- name: Install xvfb
98+
run: sudo apt-get install -y xvfb
99+
100+
- name: Build with Maven
101+
run: xvfb-run ./mvnw clean verify

.github/workflows/maven-pr-builder.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ on:
3434
jobs:
3535
build:
3636

37+
name: Build JDP
3738
runs-on: ubuntu-20.04
3839
strategy:
3940
matrix:
4041
java-version: [ 11.0.3, 11 ]
4142
steps:
43+
4244
- name: Checkout Code
4345
uses: actions/checkout@v2
4446

@@ -47,14 +49,7 @@ jobs:
4749
with:
4850
java-version: ${{ matrix.java-version }}
4951
distribution: 'zulu'
50-
51-
- name: Cache Maven Dependecies
52-
uses: actions/cache@v2
53-
with:
54-
path: ~/.m2/repository
55-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
56-
restore-keys: |
57-
${{ runner.os }}-maven-
52+
cache: 'maven'
5853

5954
# Some tests need screen access
6055
- name: Install xvfb

0 commit comments

Comments
 (0)