Skip to content

Commit aa8a74e

Browse files
committed
edit sonarcloud
1 parent d80c037 commit aa8a74e

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed
Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,47 @@
1+
name: Build
12
on:
2-
# Trigger analysis when pushing in master or pull requests, and when creating
3-
# a pull request.
43
push:
54
branches:
65
- master
7-
name: Main Workflow
6+
# pull_request:
7+
# types: [opened, synchronize, reopened]
88
jobs:
9-
sonarcloud:
10-
runs-on: ubuntu-latest
9+
build:
10+
name: Build
11+
runs-on: windows-latest
1112
steps:
13+
- name: Set up JDK 11
14+
uses: actions/setup-java@v1
15+
with:
16+
java-version: 1.11
1217
- uses: actions/checkout@v2
1318
with:
14-
# Disabling shallow clone is recommended for improving relevancy of reporting
15-
fetch-depth: 0
16-
- name: SonarCloud Scan
17-
uses: sonarsource/sonarcloud-github-action@master
19+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
20+
- name: Cache SonarCloud packages
21+
uses: actions/cache@v1
22+
with:
23+
path: ~\sonar\cache
24+
key: ${{ runner.os }}-sonar
25+
restore-keys: ${{ runner.os }}-sonar
26+
- name: Cache SonarCloud scanner
27+
id: cache-sonar-scanner
28+
uses: actions/cache@v1
29+
with:
30+
path: .\.sonar\scanner
31+
key: ${{ runner.os }}-sonar-scanner
32+
restore-keys: ${{ runner.os }}-sonar-scanner
33+
- name: Install SonarCloud scanner
34+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
35+
shell: powershell
36+
run: |
37+
New-Item -Path .\.sonar\scanner -ItemType Directory
38+
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
39+
- name: Build and analyze
1840
env:
19-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
2042
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43+
shell: powershell
44+
run: |
45+
.\.sonar\scanner\dotnet-sonarscanner begin /k:"unity-korea-community_unity-builder" /o:"unity-korea-community" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
46+
<your build command>
47+
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

0 commit comments

Comments
 (0)