-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (42 loc) · 1.25 KB
/
main.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
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
# JDK
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
# Cache
- name: Cache maven deps
uses: actions/cache@v4
env:
cache-name: cache-maven-deps
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache sonar
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-sonar-
# Build Maven
- name: Build with Maven
run: mvn -B clean verify
# Run Sonar
- name: Run sonar analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR }}
run: mvn sonar:sonar -Dsonar.organization=serendipity-projects -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN
# Codecov
- name: Code coverage
run: bash <(curl -s https://codecov.io/bash)