Skip to content

Commit b90cdd5

Browse files
committed
Improved github actions.
1 parent 0fee054 commit b90cdd5

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

.github/workflows/maven.yml

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Java CI
33
on: [push]
44

55
jobs:
6-
build:
6+
build-ubuntu:
77

88
runs-on: ubuntu-latest
99
strategy:
@@ -16,10 +16,71 @@ jobs:
1616
uses: actions/setup-java@v1
1717
with:
1818
java-version: ${{ matrix.java }}
19+
- name: Cache Maven packages
20+
uses: actions/cache@v1
21+
with:
22+
path: ~/.m2
23+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
24+
restore-keys: ${{ runner.os }}-m2
1925
- name: Build with Maven
2026
run: mvn test jacoco:report --file pom.xml -B
2127

2228
- uses: codecov/codecov-action@v1
2329
with:
2430
file: ./**/target/site/jacoco/jacoco.xml
25-
name: codecov
31+
name: codecov
32+
33+
build-windows:
34+
35+
runs-on: windows-latest
36+
strategy:
37+
matrix:
38+
java: [11, 17]
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: Set up JDK ${{ matrix.java }}
43+
uses: actions/setup-java@v1
44+
with:
45+
java-version: ${{ matrix.java }}
46+
- name: Cache Maven packages
47+
uses: actions/cache@v1
48+
with:
49+
path: ~/.m2
50+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
51+
restore-keys: ${{ runner.os }}-m2
52+
- name: Build with Maven
53+
run: mvn package --file pom.xml -B
54+
55+
build-sonar:
56+
name: Build
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v2
60+
with:
61+
fetch-depth: 0
62+
- name: Set up JDK 11
63+
uses: actions/setup-java@v1
64+
with:
65+
java-version: 11
66+
- name: Cache SonarCloud packages
67+
uses: actions/cache@v1
68+
with:
69+
path: ~/.sonar/cache
70+
key: ${{ runner.os }}-sonar
71+
restore-keys: ${{ runner.os }}-sonar
72+
- name: Cache Maven packages
73+
uses: actions/cache@v1
74+
with:
75+
path: ~/.m2
76+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
77+
restore-keys: ${{ runner.os }}-m2
78+
- name: Build and analyze
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
SONAR_TOKEN: 47bf1d4e7f3024336a676fcabe035025f05aef2d
82+
run: mvn -B test jacoco:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.organization=javadev-github -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=javadev_underscore-java
83+
- name: Build examples
84+
run: mvn -B -f examples/pom.xml package
85+
- name: Build spring-boot
86+
run: mvn -B -f spring-boot-example/pom.xml package

0 commit comments

Comments
 (0)