-
Notifications
You must be signed in to change notification settings - Fork 325
85 lines (84 loc) · 2.75 KB
/
sonar.yaml
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
name: SonarCloud Analysis
on:
push:
branches:
- main
- 3.x
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
schedule:
- cron: '00 6 * * *' # 06:00 UTC every day
jobs:
sonar:
name: Build with Sonar
runs-on: ubuntu-20.04
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d' --utc)"
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar-${{ steps.date.outputs.date }}
- uses: actions/cache@v2
id: mvn-cache
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.date }}
- name: Mvn install w/ coverage # Need this when the directory/pom structure changes
id: install1
continue-on-error: true
run: |
./mvnw \
--batch-mode \
--show-version \
--threads 1.5C \
--activate-profiles codecov \
clean \
install
- name: Retry Install on Failure
id: install2
if: steps.install1.outcome == 'failure'
run: |
./mvnw \
--batch-mode \
--show-version \
--threads 1.5C \
--activate-profiles codecov \
clean \
install
- name: Build and analyze
id: sonar1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
./mvnw \
--batch-mode \
--activate-profiles codecov \
--define sonar.projectKey=GoogleCloudPlatform_spring-cloud-gcp \
--define sonar.host.url=https://sonarcloud.io \
--define sonar.organization=googlecloudplatform \
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
- name: Retry Sonar on Failure
id: sonar2
if: steps.sonar1.outcome == 'failure'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: |
./mvnw \
--batch-mode \
--activate-profiles codecov \
--define sonar.projectKey=GoogleCloudPlatform_spring-cloud-gcp \
--define sonar.host.url=https://sonarcloud.io \
--define sonar.organization=googlecloudplatform \
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar