Skip to content

Commit 34c96cb

Browse files
authored
Merge pull request #22 from drzo/drzo-patch-7
Create multi-maven.yml
2 parents 03043b3 + cfbb7f0 commit 34c96cb

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/multi-maven.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Multi-Matrix Maven Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 2 * * *' # Runs daily at 2 AM UTC
10+
11+
jobs:
12+
build:
13+
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
java: [8, 11, 17]
18+
fail-fast: false
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v3
25+
26+
- name: Set Up Java ${{ matrix.java }}
27+
uses: actions/setup-java@v3
28+
with:
29+
distribution: 'temurin'
30+
java-version: ${{ matrix.java }}
31+
cache: maven
32+
33+
- name: Display Java Version
34+
run: java -version
35+
36+
- name: Cache Maven Dependencies
37+
uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.m2/repository
41+
!~/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin
42+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-java${{ matrix.java }}
43+
restore-keys: |
44+
${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-java
45+
${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
46+
${{ runner.os }}-m2-
47+
48+
- name: Maven Build and Test
49+
run: mvn clean verify
50+
51+
- name: Upload Test Results
52+
if: always() && matrix.os == 'ubuntu-latest'
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: test-results-${{ matrix.os }}-java${{ matrix.java }}
56+
path: target/surefire-reports/
57+
58+
- name: Notify on Failure
59+
if: failure()
60+
uses: dawidd6/action-send-mail@v3
61+
with:
62+
server_address: smtp.example.com
63+
server_port: 587
64+
username: ${{ secrets.SMTP_USERNAME }}
65+
password: ${{ secrets.SMTP_PASSWORD }}
66+
subject: 'Build Failure in ${{ matrix.os }} - Java ${{ matrix.java }}'
67+
body: |
68+
The build has failed for OS: ${{ matrix.os }} and Java: ${{ matrix.java }}.
69+
Please check the workflow logs for details.
70+
71+

0 commit comments

Comments
 (0)