Skip to content

Commit ad68d2a

Browse files
authored
Hw22 sonarqube (#1612)
-adding Sonarqube job -currently to be run manually until we figure out how to work with it
1 parent 079f7a0 commit ad68d2a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.yamato/sonarqube.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Sonarqube scanner job for the Input System Package
2+
Windows-Dotnet-SonarScanner:
3+
name: Dotnet Sonar Scanner Windows Input System
4+
agent:
5+
type: Unity::VM
6+
flavor: b1.large
7+
image: package-ci/win10-sonar:stable
8+
variables:
9+
EDITOR_VERSION: "2021.3"
10+
SONAR_HOST_URL: "https://sonar-staging.internal.unity3d.com"
11+
SONARQUBE_PROJECT_NAME: "SonarProject"
12+
SONAR_PROJECT_KEY: "input:com.unity.inputsystem"
13+
RIDER_VERSION: "3.0.12"
14+
commands:
15+
- |
16+
cd %YAMATO_WORK_DIR%
17+
unity-downloader-cli -u %EDITOR_VERSION% -c Editor --fast --wait
18+
- |
19+
unity-config project create %YAMATO_SOURCE_DIR%\%SONARQUBE_PROJECT_NAME%
20+
unity-config settings project-path %YAMATO_SOURCE_DIR%\%SONARQUBE_PROJECT_NAME%
21+
unity-config project add dependency com.unity.ide.rider@%RIDER_VERSION%
22+
move %YAMATO_SOURCE_DIR%\Packages\com.unity.inputsystem %YAMATO_SOURCE_DIR%\%SONARQUBE_PROJECT_NAME%\Packages\com.unity.inputsystem
23+
- start /W %YAMATO_WORK_DIR%\.Editor\Unity.exe -projectPath %YAMATO_SOURCE_DIR%\%SONARQUBE_PROJECT_NAME% -batchmode -quit -nographics -logFile %YAMATO_SOURCE_DIR%\%SONARQUBE_PROJECT_NAME%\Editor.log -executeMethod "Packages.Rider.Editor.RiderScriptEditor.SyncSolution"
24+
- |
25+
# If not triggered by a PR pass branch name, otherwise PR parameters
26+
IF "%YAMATO_PR_ID%" == "" ( set SONAR_ANALYSIS_TYPE_PARAM=/d:sonar.branch.name=%GIT_BRANCH% ) ELSE ( set SONAR_ANALYSIS_TYPE_PARAM=/d:sonar.pullrequest.key=%YAMATO_PR_ID% /d:sonar.pullrequest.branch=%GIT_BRANCH% /d:sonar.pullrequest.base=%YAMATO_PR_TARGET_BRANCH% )
27+
cmd /v /s /c "dotnet sonarscanner begin /k:"%SONAR_PROJECT_KEY%" /d:sonar.login=!SONAR_TOKEN_STAGING! /d:sonar.host.url=%SONAR_HOST_URL% /d:sonar.projectBaseDir=%YAMATO_SOURCE_DIR%\%SONARQUBE_PROJECT_NAME%\Packages\com.unity.inputsystem /d:sonar.sourceEncoding="UTF-8" %SONAR_ANALYSIS_TYPE_PARAM% /d:sonar.scm.provider=git /d:sonar.log.level=DEBUG /d:sonar.verbose=true /d:sonar.qualitygate.wait=true"
28+
dotnet build %YAMATO_SOURCE_DIR%\%SONARQUBE_PROJECT_NAME%\%SONARQUBE_PROJECT_NAME%.sln /t:Rebuild /p:SonarQubeTestProject=false
29+
cmd /v /s /c "dotnet sonarscanner end /d:sonar.login=!SONAR_TOKEN_STAGING!"
30+
artifacts:
31+
logs:
32+
paths:
33+
- "**/*.log"
34+
triggers:
35+
pull_requests:
36+
- targets:
37+
only:
38+
- "develop"

0 commit comments

Comments
 (0)