Skip to content

Commit a02ed21

Browse files
authored
AIRO-1561 Adding Sonarqube Scanner (Unity-Technologies#3)
* Initial sonarqube commit * Unit test, Sonar yml fixes * Sonarqube fixes, 3P notice update * Switch to prod key
1 parent c89b68a commit a02ed21

File tree

4 files changed

+173
-34
lines changed

4 files changed

+173
-34
lines changed

.yamato/sonar.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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: TestVhacd
9+
SONARQUBE_PROJECT_KEY: ai-robotics-vhacd-csharp
10+
SONARQUBE_PROJECT_BASE_DIR: /Users/bokken/build/output/Unity-Technologies/VHACD/com.unity.robotics.vhacd
11+
MSBUILD_SLN_PATH: ./TestVhacd/TestVhacd.sln
12+
PROJECT_ROOT: /Users/bokken/build/output/Unity-Technologies/VHACD/
13+
UNITY_VERSION: 2020.3.21f1
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::VM
39+
image: robotics/ci-ubuntu20:latest
40+
flavor: i1.large
41+
variables:
42+
SONARQUBE_PROJECT_KEY: ai-robotics-vhacd-standard
43+
ROOT_DIR: /home/bokken/build/output/Unity-Technologies/VHACD
44+
SRC_DIR: /home/bokken/build/output/Unity-Technologies/VHACD/src
45+
BUILD_WRAPPER_DIR: /home/bokken/build/output/Unity-Technologies/VHACD/build_wrapper_output_directory
46+
commands:
47+
- curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip -o sonar-scanner-linux.zip -L
48+
- unzip sonar-scanner-linux.zip -d ~/sonar-scanner
49+
- curl $SONARQUBE_ENDPOINT_URL_PRD/static/cpp/build-wrapper-linux-x86.zip -o sonar-build-wrapper-linux.zip -L
50+
- unzip sonar-build-wrapper-linux.zip -d ~/sonar-build-wrapper
51+
- mkdir build
52+
- cd build
53+
- cmake $SRC_DIR
54+
- ~/sonar-build-wrapper/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir $BUILD_WRAPPER_DIR make
55+
- cd $ROOT_DIR
56+
- ~/sonar-scanner/sonar-scanner-4.6.2.2472-linux/bin/sonar-scanner -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.sources=$SRC_FOLDER -Dsonar.host.url=$SONARQUBE_ENDPOINT_URL_PRD -Dsonar.login=$SONARQUBE_TOKEN_PRD -Dsonar.cfamily.build-wrapper-output=$BUILD_WRAPPER_DIR
57+
triggers:
58+
cancel_old_ci: true
59+
expression: |
60+
((pull_request.target eq "main" OR pull_request.target eq "dev")
61+
AND NOT pull_request.push.changes.all match "**/*.md") OR
62+
(push.branch eq "main" OR push.branch eq "dev")

.yamato/yamato-config.yml

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
1-
name: VHACD Unit Tests
2-
agent:
3-
type: Unity::VM
4-
image: robotics/ci-ubuntu20:v0.1.0-795910
5-
flavor: i1.large
6-
variables:
7-
COVERAGE_EXPECTED: 0
8-
PATH: /root/.local/bin:/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin
9-
commands:
10-
- git submodule update --init --recursive
11-
- python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
12-
- unity-downloader-cli -u 2020.3.21f1 -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
13-
- git clone git@github.cds.internal.unity3d.com:unity/utr.git utr
14-
- utr/utr --testproject=./TestVhacd --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=playmode --suite=editor --platform=Editor --enable-code-coverage --coverage-results-path=../test-results --coverage-options="assemblyFilters:+Unity.Robotics.VHACD,+Unity.Robotics.VHACD.Editor;generateHtmlReport;generateBadgeReport;generateAdditionalMetrics"
15-
# check test coverage
16-
- command: |
17-
linecoverage=$(cat test-results/Report/Summary.xml | grep Linecoverage | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')
18-
echo "Line coverage: $linecoverage%"
19-
if (( $(echo "$linecoverage < $COVERAGE_EXPECTED" | bc -l) ))
20-
then echo "ERROR: Code coverage is under threshold of $COVERAGE_EXPECTED%" && exit 1
21-
fi
22-
triggers:
23-
cancel_old_ci: true
24-
expression: |
25-
((pull_request.target eq "main" OR pull_request.target eq "dev")
26-
AND NOT pull_request.push.changes.all match "**/*.md") OR
27-
(push.branch eq "main" OR push.branch eq "dev")
28-
artifacts:
29-
logs:
30-
paths:
31-
- "test-results/**/*"
1+
# {% assign platforms = "linux mac windows" | split: " " %}
2+
{% assign platforms = "linux mac" | split: " " %}
3+
4+
{% for platform in platforms %}
5+
{{platform}}:
6+
name: VHACD Unit Tests ({{platform}})
7+
agent:
8+
{% if platform == "linux" %}
9+
type: Unity::VM
10+
image: robotics/ci-ubuntu20:v0.1.0-795910
11+
flavor: i1.large
12+
{% elsif platform == "mac" %}
13+
type: Unity::metal::macmini
14+
image: package-ci/mac
15+
flavor: m1.mac
16+
# {% elsif platform == "windows" %}
17+
# type: Unity::VM
18+
# image: slough-ops/win10-base:stable
19+
# flavor: b1.medium
20+
{% endif %}
21+
variables:
22+
COVERAGE_EXPECTED: 0
23+
PATH: /root/.local/bin:/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin
24+
commands:
25+
- git submodule update --init --recursive
26+
- python3 -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade
27+
- unity-downloader-cli -u 2020.3.21f1 -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published
28+
- git clone git@github.cds.internal.unity3d.com:unity/utr.git utr
29+
- utr/utr --testproject=./TestVhacd --editor-location=.Editor --reruncount=0 --artifacts_path=test-results --suite=playmode --suite=editor --platform=Editor --enable-code-coverage --coverage-results-path=../test-results --coverage-options="assemblyFilters:+Unity.Robotics.VHACD,+Unity.Robotics.VHACD.Editor;generateHtmlReport;generateBadgeReport;generateAdditionalMetrics"
30+
# check test coverage
31+
- command: |
32+
linecoverage=$(cat test-results/Report/Summary.xml | grep Linecoverage | grep -Eo '[+-]?[0-9]+([.][0-9]+)?')
33+
echo "Line coverage: $linecoverage%"
34+
if (( $(echo "$linecoverage < $COVERAGE_EXPECTED" | bc -l) ))
35+
then echo "ERROR: Code coverage is under threshold of $COVERAGE_EXPECTED%" && exit 1
36+
fi
37+
triggers:
38+
cancel_old_ci: true
39+
expression: |
40+
((pull_request.target eq "main" OR pull_request.target eq "dev")
41+
AND NOT pull_request.push.changes.all match "**/*.md") OR
42+
(push.branch eq "main" OR push.branch eq "dev")
43+
artifacts:
44+
logs:
45+
paths:
46+
- "test-results/**/*"
47+
{% endfor %}

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,26 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1212

1313
### Added
1414

15+
Added Sonarqube Scanner, multiplatform Yamato testing
16+
17+
### Changed
18+
19+
### Deprecated
20+
21+
### Removed
22+
23+
### Fixed
24+
25+
## [0.0.1-preview] - 2021-12-14
26+
27+
### Upgrade Notes
28+
29+
### Known Issues
30+
31+
### Added
32+
1533
### Changed
34+
1635
Created VHACD Unity package
1736

1837
### Deprecated

Third Party Notices.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,49 @@
1-
Component name: jasonmeisel/v-hacd-unity<br/>
2-
Copyright 2017-2020 Jason Meisel<br/>
1+
Component name: jasonmeisel/v-hacd-unity
2+
3+
License Type: Apache 2.0
4+
5+
Copyright 2017-2020 Jason Meisel
6+
7+
```
38
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at<br/>
49
510
http://www.apache.org/licenses/LICENSE-2.0<br/>
611
7-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
12+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
13+
```
14+
15+
---
16+
17+
Component name: kmammou/v-hacd
18+
19+
License Type: BSD 3-clause
20+
21+
```
22+
Copyright (c) 2011, Khaled Mamou (kmamou at gmail dot com)
23+
All rights reserved.
24+
25+
Redistribution and use in source and binary forms, with or without modification,
26+
are permitted provided that the following conditions are met:
27+
28+
Redistributions of source code must retain the above copyright notice, this
29+
list of conditions and the following disclaimer.
30+
31+
Redistributions in binary form must reproduce the above copyright notice, this
32+
list of conditions and the following disclaimer in the documentation and/or
33+
other materials provided with the distribution.
34+
35+
Neither the name of the copyright holder nor the names of its contributors
36+
may be used to endorse or promote products derived from this software without
37+
specific prior written permission.
38+
39+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
40+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
43+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
44+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
46+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
48+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49+
```

0 commit comments

Comments
 (0)