From 554081a03e3848d4ea59d3e3f0c9301d69f918e4 Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Sat, 8 Apr 2023 20:23:37 +0400 Subject: [PATCH] Update appveyor.yml --- appveyor.yml | 75 ++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 00a527f..534a556 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,16 +11,18 @@ environment: secure: AD1z81FqZlvGkCEyDzJ3g6sIJ93ecUE9EuqfUxc4CMiFGW139pWZk+/huuTY5jzG CODACY_PROJECT_TOKEN: secure: Dz2jqsK+hAKCFEGgumfJORPt5Ka6/X7UMR5RyG10etlqiGkUH7TSrGtdFlnjaZm1 + CODECLIMATE_TOKEN: + secure: dStWUK1y0OKwT48aK3F/dJzuiDAOXVct+Olg4il66JcOEe3i1zEqQdBeMip/xSSlDzswxEVBs9GzhM10dfilbRB9TZ54AZ7rnC+cuvdQ3CU= dotnet_csproj: - patch: true - file: '**\*.csproj' - version: '{version}' - package_version: '{version}' - assembly_version: '{version}' - file_version: '{version}' - informational_version: '{version}' - + patch: true + file: '**\*.csproj' + version: '{version}' + package_version: '{version}' + assembly_version: '{version}' + file_version: '{version}' + informational_version: '{version}' + init: - SET JAVA_HOME=C:\Program Files\Java\jdk19 - SET PATH=%JAVA_HOME%\bin;%PATH% @@ -32,6 +34,7 @@ before_build: - cmd: choco install opencover.portable - cmd: choco install codecov - cmd: curl -L https://github.com/codacy/codacy-coverage-reporter/releases/latest/download/codacy-coverage-reporter-assembly.jar > ./codacy-test-reporter.jar +- cmd: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-windows-amd64 > codeclimate-test-reporter.exe - cmd: dotnet tool install --global dotnet-sonarscanner build: @@ -41,41 +44,22 @@ build: verbosity: normal build_script: -- ps: 'if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { & - dotnet sonarscanner begin - /k:"$env:SONAR_PROJECT" - /o:"$env:SONAR_ORGANIZATION" - /d:sonar.branch.name="$env:APPVEYOR_REPO_BRANCH" - /d:sonar.host.url="https://sonarcloud.io" - /d:sonar.login="$env:SONAR_TOKEN" - /v:"$env:APPVEYOR_BUILD_NUMBER" - /d:sonar.exclusions="**/bin/**/*,**/obj/**/*" - /d:sonar.coverage.exclusions="**/$env:SOLUTION_NAME.Tests/**,**/*Tests.cs" - /d:sonar.cs.opencover.reportsPaths="$env:CD\Tests\$env:SOLUTION_NAME.Tests\coverage.opencover.xml" - }' -- ps: 'if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { & - dotnet sonarscanner begin - /k:"$env:SONAR_PROJECT" - /o:"$env:SONAR_ORGANIZATION" - /d:sonar.pullrequest.key="$env:APPVEYOR_PULL_REQUEST_NUMBER" - /d:sonar.host.url="https://sonarcloud.io" - /d:sonar.login="$env:SONAR_TOKEN" - /v:"$env:APPVEYOR_BUILD_NUMBER" - /d:sonar.exclusions="**/bin/**/*,**/obj/**/*" - /d:sonar.coverage.exclusions="**/$env:SOLUTION_NAME.Tests/**,**/*Tests.cs" - /d:sonar.cs.opencover.reportsPaths="$env:CD\Tests\$env:SOLUTION_NAME.Tests\coverage.opencover.xml" - }' +- ps: $Params = "/k:`"$env:SONAR_PROJECT`"", "/o:`"$env:SONAR_ORGANIZATION`"", "/v:`"$env:APPVEYOR_BUILD_NUMBER`"" +- ps: $Params += "/d:sonar.host.url=`"https://sonarcloud.io`"", "/d:sonar.login=`"$env:SONAR_TOKEN`"" +- ps: $Params += "/d:sonar.exclusions=`"**/bin/**/*,**/obj/**/*`"", "/d:sonar.coverage.exclusions=`"**/$env:SOLUTION_NAME.Tests/**,**/*Tests.cs`"" +- ps: $Params += "/d:sonar.cs.opencover.reportsPaths=`"$env:CD\Tests\$env:SOLUTION_NAME.Tests\coverage.opencover.xml`"" +- ps: if(-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { $Params += "/d:sonar.branch.name=`"$env:APPVEYOR_REPO_BRANCH`"" } +- ps: if($env:APPVEYOR_PULL_REQUEST_NUMBER) { $Params += "/d:sonar.pullrequest.key=$env:APPVEYOR_PULL_REQUEST_NUMBER" } +- ps: Start-process "dotnet" "sonarscanner begin $($Params -join ' ')" +- codeclimate-test-reporter before-build - dotnet build %SOLUTION_NAME%.sln -- dotnet test .\Tests\%SOLUTION_NAME%.Tests\%SOLUTION_NAME%.Tests.csproj - /p:CollectCoverage=true - /p:CoverletOutputFormat="opencover" +- dotnet test .\Tests\%SOLUTION_NAME%.Tests\%SOLUTION_NAME%.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat="cobertura" +- dotnet test .\Tests\%SOLUTION_NAME%.Tests\%SOLUTION_NAME%.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat="lcov" +- dotnet test .\Tests\%SOLUTION_NAME%.Tests\%SOLUTION_NAME%.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat="opencover" +- codeclimate-test-reporter format-coverage -t lcov -o "%CD%\Tests\%SOLUTION_NAME%.Tests\code-climate.json" "%CD%\Tests\%SOLUTION_NAME%.Tests\coverage.info" +- codeclimate-test-reporter upload-coverage -i "%CD%\Tests\%SOLUTION_NAME%.Tests\code-climate.json" -r %CODECLIMATE_TOKEN% - codecov -f "%CD%\Tests\%SOLUTION_NAME%.Tests\coverage.opencover.xml" -- java - -jar - ./codacy-test-reporter.jar report - -l CSharp - -t %CODACY_PROJECT_TOKEN% - -r "%CD%\Tests\%SOLUTION_NAME%.Tests\coverage.opencover.xml" +- java -jar ./codacy-test-reporter.jar report -l CSharp -t %CODACY_PROJECT_TOKEN% -r "%CD%\Tests\%SOLUTION_NAME%.Tests\coverage.opencover.xml" - dotnet sonarscanner end /d:sonar.login="%SONAR_TOKEN%" after_build: @@ -87,6 +71,7 @@ after_build: - xcopy %CD%\Tests\%SOLUTION_NAME%.Tests\*.xml %CD%\Coverage\ - xcopy %CD%\Tests\%SOLUTION_NAME%.Tests\*.json %CD%\Coverage\ +- xcopy %CD%\Tests\%SOLUTION_NAME%.Tests\*.info %CD%\Coverage\ - cd %CD% @@ -117,3 +102,11 @@ deploy: auth_token: $(GITHUB_TOKEN) force_update: true artifact: ZipFile + +- provider: GitHub + on: + branch: main + tag: $(appveyor_build_version) + auth_token: $(GITHUB_TOKEN) + force_update: true + artifact: Coverage