* Add sonarqube scanners

* Sonarqube path fix

* Add Yamato variables

* Switch to prod key

Co-authored-by: Amanda Trang <amanda.trang@unity3d.com>
This commit is contained in:
peifeng-unity 2021-12-10 15:47:11 -08:00 коммит произвёл GitHub
Родитель 7435de4f8a
Коммит 88bbc9d8fc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 60 добавлений и 6 удалений

52
.yamato/sonar.yml Normal file
Просмотреть файл

@ -0,0 +1,52 @@
csharp:
name: Sonarqube C# Scan
agent:
type: Unity::metal::macmini
image: package-ci/mac
flavor: m1.mac
variables:
PROJECT_PATH: tutorials/pick_and_place/PickAndPlaceProject
SONARQUBE_PROJECT_KEY: ai-robotics-hub-csharp
SONARQUBE_PROJECT_BASE_DIR: /Users/bokken/build/output/Unity-Technologies/Unity-Robotics-Hub/tutorials/pick_and_place/PickAndPlaceProject
MSBUILD_SLN_PATH: ./tutorials/pick_and_place/PickAndPlaceProject/PickAndPlaceProject.sln
PROJECT_ROOT: /Users/bokken/build/output/Unity-Technologies/Unity-Robotics-Hub/
UNITY_VERSION: 2020.3.11f1
commands:
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.it.unity3d.com/artifactory/api/npm/upm-npm
- unity-downloader-cli -u $UNITY_VERSION -c Editor
- brew install mono corretto
- 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
- unzip sonar-scanner-msbuild-net46.zip -d ~/sonar-scanner-msbuild
- chmod a+x ~/sonar-scanner-msbuild/sonar-scanner-4.6.1.2450/bin/sonar-scanner
- .Editor/Unity.app/Contents/MacOS/Unity -projectPath $PROJECT_PATH -batchmode -quit -nographics -logFile - -executeMethod "UnityEditor.SyncVS.SyncSolution"
- command: |
cd $PROJECT_PATH
for file in *.csproj; do sed -i.backup "s/^[[:blank:]]*<ReferenceOutputAssembly>false<\/ReferenceOutputAssembly>/<ReferenceOutputAssembly>true<\/ReferenceOutputAssembly>/g" $file; rm $file.backup; done
cd $PROJECT_ROOT
- 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
- msbuild $MSBUILD_SLN_PATH
- mono ~/sonar-scanner-msbuild/SonarScanner.MSBuild.exe end /d:sonar.login=$SONARQUBE_TOKEN_PRD
triggers:
cancel_old_ci: true
expression: |
((pull_request.target eq "main" OR pull_request.target eq "dev")
AND NOT pull_request.push.changes.all match "**/*.md") OR
(push.branch eq "main" OR push.branch eq "dev")
standard:
name: Sonarqube Standard Scan
agent:
type: Unity::metal::macmini
image: package-ci/mac
flavor: m1.mac
variables:
SONARQUBE_PROJECT_KEY: ai-robotics-hub-standard
commands:
- curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-macosx.zip -o sonar-scanner-macosx.zip -L
- unzip sonar-scanner-macosx.zip -d ~/sonar-scanner
- ~/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
triggers:
cancel_old_ci: true
expression: |
((pull_request.target eq "main" OR pull_request.target eq "dev")
AND NOT pull_request.push.changes.all match "**/*.md") OR
(push.branch eq "main" OR push.branch eq "dev")

Просмотреть файл

@ -6,18 +6,20 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
## Unreleased
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.
Add the [Close Stale Issues](https://github.com/marketplace/actions/close-stale-issues) action
Updated Pick-and-Place scripts for style conformity, updated custom msg formats and made according script and tutorial changes.
### Upgrade Notes
### Known Issues
### Added
Added Sonarqube scanners.
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.
Add the [Close Stale Issues](https://github.com/marketplace/actions/close-stale-issues) action
Updated Pick-and-Place scripts for style conformity, updated custom msg formats and made according script and tutorial changes.
### Changed
### Deprecated