Skip to content

Commit 88bbc9d

Browse files
peifeng-unityat669
andauthored
Add Sonarqube scanners (#336)
* Add sonarqube scanners * Sonarqube path fix * Add Yamato variables * Switch to prod key Co-authored-by: Amanda Trang <amanda.trang@unity3d.com>
1 parent 7435de4 commit 88bbc9d

File tree

2 files changed

+60
-6
lines changed

2 files changed

+60
-6
lines changed

.yamato/sonar.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
csharp:
2+
name: Sonarqube C# Scan
3+
agent:
4+
type: Unity::metal::macmini
5+
image: package-ci/mac
6+
flavor: m1.mac
7+
variables:
8+
PROJECT_PATH: tutorials/pick_and_place/PickAndPlaceProject
9+
SONARQUBE_PROJECT_KEY: ai-robotics-hub-csharp
10+
SONARQUBE_PROJECT_BASE_DIR: /Users/bokken/build/output/Unity-Technologies/Unity-Robotics-Hub/tutorials/pick_and_place/PickAndPlaceProject
11+
MSBUILD_SLN_PATH: ./tutorials/pick_and_place/PickAndPlaceProject/PickAndPlaceProject.sln
12+
PROJECT_ROOT: /Users/bokken/build/output/Unity-Technologies/Unity-Robotics-Hub/
13+
UNITY_VERSION: 2020.3.11f1
14+
commands:
15+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.it.unity3d.com/artifactory/api/npm/upm-npm
16+
- unity-downloader-cli -u $UNITY_VERSION -c Editor
17+
- brew install mono corretto
18+
- curl https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/5.2.1.31210/sonar-scanner-msbuild-5.2.1.31210-net46.zip -o sonar-scanner-msbuild-net46.zip -L
19+
- unzip sonar-scanner-msbuild-net46.zip -d ~/sonar-scanner-msbuild
20+
- chmod a+x ~/sonar-scanner-msbuild/sonar-scanner-4.6.1.2450/bin/sonar-scanner
21+
- .Editor/Unity.app/Contents/MacOS/Unity -projectPath $PROJECT_PATH -batchmode -quit -nographics -logFile - -executeMethod "UnityEditor.SyncVS.SyncSolution"
22+
- command: |
23+
cd $PROJECT_PATH
24+
for file in *.csproj; do sed -i.backup "s/^[[:blank:]]*<ReferenceOutputAssembly>false<\/ReferenceOutputAssembly>/<ReferenceOutputAssembly>true<\/ReferenceOutputAssembly>/g" $file; rm $file.backup; done
25+
cd $PROJECT_ROOT
26+
- mono ~/sonar-scanner-msbuild/SonarScanner.MSBuild.exe begin /k:$SONARQUBE_PROJECT_KEY /d:sonar.host.url=$SONARQUBE_ENDPOINT_URL_PRD /d:sonar.login=$SONARQUBE_TOKEN_PRD /d:sonar.projectBaseDir=$SONARQUBE_PROJECT_BASE_DIR
27+
- msbuild $MSBUILD_SLN_PATH
28+
- mono ~/sonar-scanner-msbuild/SonarScanner.MSBuild.exe end /d:sonar.login=$SONARQUBE_TOKEN_PRD
29+
triggers:
30+
cancel_old_ci: true
31+
expression: |
32+
((pull_request.target eq "main" OR pull_request.target eq "dev")
33+
AND NOT pull_request.push.changes.all match "**/*.md") OR
34+
(push.branch eq "main" OR push.branch eq "dev")
35+
standard:
36+
name: Sonarqube Standard Scan
37+
agent:
38+
type: Unity::metal::macmini
39+
image: package-ci/mac
40+
flavor: m1.mac
41+
variables:
42+
SONARQUBE_PROJECT_KEY: ai-robotics-hub-standard
43+
commands:
44+
- curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-macosx.zip -o sonar-scanner-macosx.zip -L
45+
- unzip sonar-scanner-macosx.zip -d ~/sonar-scanner
46+
- ~/sonar-scanner/sonar-scanner-4.6.2.2472-macosx/bin/sonar-scanner -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.sources=. -Dsonar.host.url=$SONARQUBE_ENDPOINT_URL_PRD -Dsonar.login=$SONARQUBE_TOKEN_PRD
47+
triggers:
48+
cancel_old_ci: true
49+
expression: |
50+
((pull_request.target eq "main" OR pull_request.target eq "dev")
51+
AND NOT pull_request.push.changes.all match "**/*.md") OR
52+
(push.branch eq "main" OR push.branch eq "dev")

CHANGELOG.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66

77
## Unreleased
88

9-
Fixed the ROS-Unity Integration tutorial `robo_demo.launch` to be up-to-date with file paths, and updated Pick-and-Place Part 2 ROS Settings screenshot.
10-
11-
Add the [Close Stale Issues](https://github.com/marketplace/actions/close-stale-issues) action
12-
13-
Updated Pick-and-Place scripts for style conformity, updated custom msg formats and made according script and tutorial changes.
14-
159
### Upgrade Notes
1610

1711
### Known Issues
1812

1913
### Added
2014

15+
Added Sonarqube scanners.
16+
17+
Fixed the ROS-Unity Integration tutorial `robo_demo.launch` to be up-to-date with file paths, and updated Pick-and-Place Part 2 ROS Settings screenshot.
18+
19+
Add the [Close Stale Issues](https://github.com/marketplace/actions/close-stale-issues) action
20+
21+
Updated Pick-and-Place scripts for style conformity, updated custom msg formats and made according script and tutorial changes.
22+
2123
### Changed
2224

2325
### Deprecated

0 commit comments

Comments
 (0)