-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (87 loc) · 2.99 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
86
87
88
89
90
name: Sonar
on:
workflow_dispatch:
push:
branches:
- development
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonar-java:
name: SonarCloud Java
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'adopt'
- name: Scan via gradle
run: >-
./gradlew
--build-cache
-x test
-x spotlessJava
-x spotlessJavaApply
-x spotlessJavaCheck
-x spotlessCheck
-x spotlessApply
build sonar -info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Notify slack on failure
uses: broadinstitute/[email protected]
if: failure() && github.ref == 'refs/heads/development'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
channel: '#juniper-dev-notifications'
status: failure
author_name: SonarCloud Java scan failed on merge to development
fields: job
text: "SonarCloud Java scan failed :sadpanda:"
username: 'Juniper Build Notifications'
sonar-typescript:
name: SonarCloud TypeScript
runs-on: ubuntu-latest
strategy:
matrix:
subproject: ['ui-admin', 'ui-core', 'ui-participant']
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: Set SonarCloud parameters
id: set-sonar-params
run: |
if [[ "${{ steps.branch-name.outputs.current_branch }}" != "development" ]]; then
echo "SONAR_ARGS=-Dsonar.branch.target=${{ github.event.repository.default_branch }} -Dsonar.branch.name=${{ steps.branch-name.outputs.current_branch }}" >> $GITHUB_ENV
fi
- name: Scan ${{ matrix.subproject }} via sonarcloud-github-action
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: ${{ github.workspace }}/${{ matrix.subproject }}
args: >
${{ env.SONAR_ARGS }}
- name: Notify slack on failure
uses: broadinstitute/[email protected]
if: failure() && github.ref == 'refs/heads/development'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
channel: '#juniper-dev-notifications'
status: failure
author_name: SonarCloud TypeScript scan failed on merge to development
fields: job
text: "SonarCloud TypeScript scan failed :sadpanda:"
username: 'Juniper Build Notifications'