-
Notifications
You must be signed in to change notification settings - Fork 7
136 lines (134 loc) · 4.2 KB
/
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Java CI
on:
pull_request:
merge_group:
push:
branches:
- 'master'
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
release:
types:
- created
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java: [11, 13, 15, 17]
name: Java ${{ matrix.java }} Run
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Cache Maven Dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ares-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
ares-maven-
- name: Test with Maven and JDK ${{ matrix.java }}
run: mvn -B clean test
test-gradle:
runs-on: ubuntu-latest
strategy:
matrix:
java: [17]
name: Java ${{ matrix.java }} Gradle Run
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Cache Maven Dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ares-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
ares-maven-
- name: Move Gradle build file
run: mv ./src/test/resources/build.gradle ./build.gradle
- name: Build and Install with Maven and JDK ${{ matrix.java }}
run: mvn -B clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true
- name: Test with Gradle and JDK ${{ matrix.java }}
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 7.4
arguments: test
code-style:
runs-on: ubuntu-latest
name: Check Code Style
steps:
- uses: actions/checkout@v4
- name: Set up JDK 15
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 15
- name: Cache Maven Dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ares-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
ares-maven-
- name: Check code style with Maven
run: mvn -B spotless:check
sonar-scanner:
needs: test
runs-on: ubuntu-latest
name: SonarCloud Java 16
steps:
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Set up JDK 16
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Cache Maven Dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ares-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
ares-maven-
- name: Run SonarScanner for SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B -P coverage clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=artemis-java-test-sandbox -Dsonar.organization=maisikoleni -Dsonar.host.url=https://sonarcloud.io
deploy:
if: startsWith(github.event.ref, 'refs/tags/')
needs: [code-style, test, test-gradle]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
- name: Cache Maven Dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ares-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
ares-maven-
- name: Build and Deploy with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>github</id><username>MaisiKoleni</username><password>${GITHUB_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml
mvn -B -Dmaven.wagon.http.pool=false clean deploy -P github