Skip to content

Commit eca3710

Browse files
Update CI pipeline to define Build with Maven and Run tests as separate jobs
1 parent 53cf7ad commit eca3710

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99

1010
jobs:
1111
build:
12+
name: Build with Maven
1213
runs-on: ubuntu-latest
1314

1415
steps:
@@ -38,5 +39,36 @@ jobs:
3839
- name: Build with Maven
3940
run: mvn -B package --file pom.xml
4041

42+
- name: Run tests
43+
run: mvn clean test
44+
45+
test:
46+
name: Run tests
47+
runs-on: ubuntu-latest
48+
needs: build
49+
steps:
50+
- name: Check out the repository
51+
uses: actions/checkout@v3
52+
53+
- name: Set up JDK 21
54+
uses: actions/setup-java@v3
55+
with:
56+
distribution: 'temurin'
57+
java-version: '21'
58+
cache: maven
59+
60+
- name: Set up Maven
61+
uses: stCarolas/[email protected]
62+
with:
63+
maven-version: 3.9.6
64+
65+
- name: Cache Maven packages
66+
uses: actions/cache@v3
67+
with:
68+
path: ~/.m2/repository
69+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
70+
restore-keys: |
71+
${{ runner.os }}-maven-
72+
4173
- name: Run tests
4274
run: mvn clean test

0 commit comments

Comments
 (0)