-
Notifications
You must be signed in to change notification settings - Fork 7
106 lines (104 loc) · 3.11 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
name: Java CI
on:
pull_request:
push:
branches:
- 'master'
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
release:
types:
- created
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java: [11, 12, 13, 14, 15, 16, 17-ea]
name: Java ${{ matrix.java }} Run
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Cache Maven Dependencies
uses: actions/[email protected]
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
code-style:
runs-on: ubuntu-latest
name: Check Code Style
steps:
- uses: actions/checkout@v2
- name: Set up JDK 15
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 15
- name: Cache Maven Dependencies
uses: actions/[email protected]
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@v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Set up JDK 16
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 16
- name: Cache Maven Dependencies
uses: actions/[email protected]
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]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 11
- name: Cache Maven Dependencies
uses: actions/[email protected]
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