forked from jboulon/influent
-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (60 loc) · 1.97 KB
/
multi-maven.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Multi-Matrix Maven Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 2 * * *' # Runs daily at 2 AM UTC
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
java: [8, 11, 17]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: maven
- name: Display Java Version
run: java -version
- name: Cache Maven Dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
!~/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-java${{ matrix.java }}
restore-keys: |
${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-java
${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-
- name: Maven Build and Test
run: mvn clean verify
- name: Upload Test Results
if: always() && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.os }}-java${{ matrix.java }}
path: target/surefire-reports/
- name: Notify on Failure
if: failure()
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.example.com
server_port: 587
username: ${{ secrets.SMTP_USERNAME }}
password: ${{ secrets.SMTP_PASSWORD }}
subject: 'Build Failure in ${{ matrix.os }} - Java ${{ matrix.java }}'
body: |
The build has failed for OS: ${{ matrix.os }} and Java: ${{ matrix.java }}.
Please check the workflow logs for details.
# to: [email protected]
# from: [email protected]