-
Notifications
You must be signed in to change notification settings - Fork 3
50 lines (48 loc) · 1.69 KB
/
ci.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
name: CI
on:
push:
branches:
- master
- release/**
pull_request:
jobs:
CI_Sonar:
# carries Sonar secret
environment: CI
env:
# The SonarScanner for Maven automatically picks up the value directly from the environment variable.
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# According to Sonar: Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# unlimited fetch depth for Sonar
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
# some arbitrary distribution selected
distribution: 'temurin'
cache: maven
- name: Build with Maven
# -B means: batch-mode (no questions, no progress-related log pollution)
# coverage profile is needed for test coverage for sonar
run: mvn test -Pcoverage -B
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
# some arbitrary distribution selected
distribution: 'temurin'
cache: maven
- name: Run Sonar analyzing
# specified the project key explicitly because I didn't like the automatically generate Maven-based name (com.leokom:chess)
# thanks to this explicit specification we're free to change Maven coordinates
# the organization key was found here: https://sonarcloud.io/account/organizations
run: mvn sonar:sonar
-Dsonar.projectKey=leokom-chess
-Dsonar.organization=lrozenblyum-github
-Dsonar.host.url=https://sonarcloud.io