-
Notifications
You must be signed in to change notification settings - Fork 3
100 lines (94 loc) · 2.86 KB
/
build.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
# Building workflow for moonlight
name: Build & Test & Analyze
on: [push, pull_request]
jobs:
build:
name: Java build
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: build with Gradle
run: ./gradlew build
- name: Save build cache
uses: actions/cache/save@v3
with:
path: ./build
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}
# Tests running and static code analysis
test:
name: Run Tests
needs: build
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Restore build cache
uses: actions/cache/restore@v3
with:
path: ./build
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}
- name: Gradle check
run: ./gradlew check
- name: Save tests cache
uses: actions/cache/save@v3
with:
path: ./build
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}
analyze:
name: Static code analysis
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Restore tests cache
uses: actions/cache/restore@v3
with:
path: ./build
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ./.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Sonar analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew analyze
- name: Codecov update
uses: codecov/codecov-action@v3
with:
token: "d76dfcb2-9baa-40e4-b07a-4b2647bcf3c4" # should be moved to ${{ secrets.CODECOV_TOKEN }}
files: "./build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)