Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
208 lines (164 sloc) 6.44 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
name: $(TeamProject)_$(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
trigger:
- master
jobs:
- job: Build_With_Test
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- script: |
cd InfoValutar
dotnet tool restore
displayName: restore tools
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
# - task: VSTest@2
# inputs:
# platform: '$(buildPlatform)'
# configuration: '$(buildConfiguration)'
- script: |
cd InfoValutar
dotnet test --logger trx --configuration $(buildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura -v m /p:CoverletOutput=cob.xml
dotnet reportgenerator "-reports:InfovalutarTest/cob.xml" "-targetdir:coveragereport" "-reporttypes:HTMLInline;HTMLSummary;Badges"
displayName: restore tools
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: cobertura
summaryFileLocation: '**/cob.xml'
- job: Build_Docker
dependsOn:
- Build_With_Test
condition: and(succeeded(),true)
pool:
vmImage: 'ubuntu-16.04'
steps:
- script: |
docker image ls
cd docker
docker build -f dockerForWebAPI.txt -t infovalutar ..
echo $MY_PASSWORD_DOCKER| docker login --username ignatandrei --password-stdin
docker tag infovalutar ignatandrei/infovalutar
docker push ignatandrei/infovalutar
displayName: create docker
- job: DeployAzureSite
dependsOn:
- Build_With_Test
condition: and(succeeded(),true)
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- script: |
cd InfoValutar
dotnet tool restore
displayName: restore tools
- script: |
dotnet build --configuration $(buildConfiguration) -r linux-x64 InfoValutar/InfoValutar.sln /m:1
dotnet publish InfoValutar/InfoValutarWebAPI/InfoValutarWebAPI.csproj --configuration $(buildConfiguration) --no-build -r linux-x64 -p:PublishSingleFile=false -o $(Build.ArtifactStagingDirectory)/InfoValLinuxX64
displayName: publish again
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/InfoValLinuxX64'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/InfoValLinuxX64.zip'
replaceExistingArchive: true
displayName: 'arhive files'
- script: |
dir $(System.ArtifactsDirectory)\*.zip /s /b
displayName: finding zip after Publish
- task: AzureAppServiceManage@0
inputs:
azureSubscription: 'InfoValutarServiceConnection'
action: 'Stop Azure App Service'
WebAppName: 'infovalutar'
ResourceGroupName: 'infovalutarRG'
displayName: stop azure
- task: AzureRmWebAppDeployment@4
inputs:
azureSubscription: 'InfoValutarServiceConnection'
WebAppName: 'infovalutar'
Package: $(System.ArtifactsDirectory)/*InfoValLinuxX64*.zip
ResourceGroupName: 'infovalutarRG'
displayName: deploy to azure
- task: AzureAppServiceManage@0
inputs:
azureSubscription: 'InfoValutarServiceConnection'
action: 'Start Azure App Service'
WebAppName: 'infovalutar'
ResourceGroupName: 'infovalutarRG'
condition: always() # always restart azure
displayName: start azure
- job: DeployAzureFunction
dependsOn:
- Build_With_Test
condition: and(succeeded(),true)
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- script: |
cd InfoValutar
dotnet tool restore
displayName: restore tools
- script: |
echo "start build"
dotnet build --configuration $(buildConfiguration) -r linux-x64 InfoValutar/InfoValutar.sln /m:1
echo "----done build, start publish InfoValutarLoadingLibs"
dotnet publish InfoValutar/InfoValutarLoadingLibs/InfoValutarLoadingLibs.csproj --configuration $(buildConfiguration) --self-contained --no-restore --no-build -r linux-x64 -p:PublishSingleFile=false -o $(Build.ArtifactStagingDirectory)/InfoValLinuxX64LoadingLibs
echo "--- done publish, start publish AzureFuncLoadData"
dotnet publish InfoValutar/AzureFuncLoadData/AzureFuncLoadData.csproj --configuration $(buildConfiguration) --no-build -r linux-x64 -p:PublishSingleFile=false -o $(Build.ArtifactStagingDirectory)/InfoValLinuxX64
echo "-- done publish, start xcopy"
xcopy $(Build.ArtifactStagingDirectory)\InfoValLinuxX64LoadingLibs\*.* $(Build.ArtifactStagingDirectory)\InfoValLinuxX64\bin\ /Y /D
displayName: publish again
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/InfoValLinuxX64'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/InfoValLinuxX64.zip'
replaceExistingArchive: true
displayName: 'arhive files'
- task: AzureFunctionApp@1
displayName: Azure Function App Deploy
inputs:
azureSubscription: 'InfoValutarServiceConnection'
appName: azurefuncloaddata20191205080713
package: $(Build.ArtifactStagingDirectory)/InfoValLinuxX64.zip
- task: PublishBuildArtifacts@1
inputs:
artifactName: 'azureFunction'
You can’t perform that action at this time.