-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) · 1.09 KB
/
maven-build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Build and Test
on:
pull_request:
branches:
- main
paths-ignore:
- "**/README.md"
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for better caching
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "adopt"
cache: maven
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn clean install -T 4 # Build with 4 threads
- name: Run unit tests
run: mvn test
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: test-results
path: target/surefire-reports