diff --git a/.drone.yml b/.drone.yml index 52e8e4a..2e44e00 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,21 +4,39 @@ type: docker trigger: event: - - push - pull_request steps: - name: unity-tests image: docker.io/library/unity-runner:0.1 commands: - - /opt/unity/editors/2021.3.19f1/Editor/Unity -runTests -batchmode -nographics -projectPath . -testResults results_editmode.xml -testPlatform EditMode || true - - /opt/unity/editors/2021.3.19f1/Editor/Unity -runTests -batchmode -nographics -projectPath . -testResults results_playmode.xml -testPlatform PlayMode || true + - mkdir code_coverage + - chmod 777 code_coverage + - /opt/unity/editors/2021.3.19f1/Editor/Unity -runTests -batchmode -nographics -projectPath . -testResults results_editmode.xml -testPlatform EditMode -debugCodeOptimization -enableCodeCoverage -coverageResultsPath code_coverage -coverageOptions "generateAdditionalMetrics;pathFilters:-**Assets/MediaPipeUnity/Common/**,-**Assets/**Test*.cs;dontClear" || true + - /opt/unity/editors/2021.3.19f1/Editor/Unity -runTests -batchmode -nographics -projectPath . -testResults results_playmode.xml -testPlatform PlayMode -debugCodeOptimization -enableCodeCoverage -coverageResultsPath code_coverage -coverageOptions "generateAdditionalMetrics;pathFilters:-**Assets/MediaPipeUnity/Common/**,-**Assets/**Test*.cs;dontClear" || true + - /opt/unity/editors/2021.3.19f1/Editor/Unity -batchmode -nographics -projectPath . -debugCodeOptimization -enableCodeCoverage -coverageResultsPath code_coverage -coverageOptions "generateAdditionalReports;pathFilters:-**Assets/MediaPipeUnity/Common/**,-**Assets/**Test*.cs" -quit || true + - ls code_coverage + - ls code_coverage/Report - name: tests-parser image: docker.io/library/unity-test-parser:0.1 commands: - python /app/unity_test_parser.py results_editmode.xml results_playmode.xml + - name: sonarqube-code-coverage + pull: if-not-exists + image: sonarsource/sonar-scanner-cli + commands: + - sonar-scanner -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.coverageReportPaths="./code_coverage/Report/SonarQube.xml" + environment: + SONAR_HOST: + from_secret: sonar_host + SONAR_TOKEN: + from_secret: sonar_token + SONAR_PROJECT_KEY: + from_secret: sonar_project_key + + --- kind: pipeline name: builds