Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
109 lines (91 sloc) 3.99 KB
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
branches:
include:
- master
paths:
exclude:
- docs/*
- README.md
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
deployNuget: '0'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- script: |
cd src
dotnet tool restore --add-source https://myget.org/F/natemcmaster/api/v3/index.json
pwsh ./setVersion.ps1
dotnet build --configuration $(buildConfiguration) WebAPI2CLI.sln /m:1
dotnet publish TestWebAPISite/TestWebAPISite.csproj -c $(buildConfiguration) --self-contained true --no-build -r win10-x64 -p:PublishSingleFile=true -o:$(Build.ArtifactStagingDirectory)
copy TestWebAPISite\cli.txt $(Build.ArtifactStagingDirectory)\cli.txt
displayName: build sln
- script: |
cd src
cmd /k set
dotnet tool restore --add-source https://myget.org/F/natemcmaster/api/v3/index.json
dotnet test WebAPI2CLI.sln --logger trx --no-build -r $(Build.ArtifactStagingDirectory)\trx -o CLITests\bin\$(buildConfiguration)\netcoreapp3.1
cd CLITests
rem echo 'xunit'
rem dotnet xunit bin\$(buildConfiguration)\netcoreapp3.1\CLITests.dll -parallel none -html $(Build.ArtifactStagingDirectory)\tests.html
echo 'coverlet'
dotnet coverlet bin\$(buildConfiguration)\netcoreapp3.1\CLITests.dll --target "dotnet" --targetargs "test --no-build --configuration $(buildConfiguration)" --exclude '[*Test*]*' --format opencover --output $(Build.ArtifactStagingDirectory)\testResults\coverlet.xml
dotnet reportgenerator "-reports:$(Build.ArtifactStagingDirectory)\testResults\coverlet.xml" "-targetdir:$(Build.ArtifactStagingDirectory)\testResults" "-reporttypes:Cobertura;HtmlSummary;Badges;HtmlInline_AzurePipelines"
displayName: execute tests
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/*.trx'
searchFolder: '$(Build.ArtifactStagingDirectory)\trx'
displayName: publish tests
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.ArtifactStagingDirectory)\testResults\Cobertura.xml'
reportDirectory: '$(Build.ArtifactStagingDirectory)\testResults'
# - task: VSTest@2
# inputs:
# testSelector: 'testAssemblies'
# testAssemblyVer2: | # Required when testSelector == TestAssemblies
# **\*CLITests*.dll
# !**\obj\**
# runInParallel: False
# publishRunAttachments: true
# codeCoverageEnabled: true
- script: |
echo "pack ExtensionNetCore3.csproj"
dotnet pack src/ExtensionNetCore3/ExtensionNetCore3.csproj --include-source --no-build -o $(Build.ArtifactStagingDirectory) /p:Configuration=$(buildConfiguration)
echo "pack CLIExecute.csproj"
dotnet pack src/CLIExecute/CLIExecute.csproj --include-source --no-build -o $(Build.ArtifactStagingDirectory) /p:Configuration=$(buildConfiguration)
displayName: 'dotnet pack '
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop1
- task: NuGetCommand@2
condition: and(succeeded(), eq(variables['deployNuget'], '1'))
inputs:
command: push
nuGetFeedType: external
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
publishFeedCredentials: 'nugetAndrei'
displayName: 'dotnet nuget push'
- script: |
nuget push $(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg %MYGETAPIKEY% -Source https://www.myget.org/F/ignatandrei/api/v2/package
displayName: push myget
- script: |
cd $(Build.ArtifactStagingDirectory)
echo "testing"
TestWebAPISite.exe --CLI_ENABLED=1 --CLI_Commands="GetMathId_Http,MathPOST"
displayName: runningADemo
You can’t perform that action at this time.