aboutsummaryrefslogtreecommitdiff
path: root/azure-pipelines.yml
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-10-17 13:25:28 +0800
committer杨宇千 <crupest@outlook.com>2019-10-17 13:25:28 +0800
commite63f67d335efef91930e274f9703d76e0d363099 (patch)
tree65992454583719965e73c047bb4cd710762a85be /azure-pipelines.yml
parentc0292eeb2eb1d531cede4b3fdfead86a86730056 (diff)
downloadtimeline-e63f67d335efef91930e274f9703d76e0d363099.tar.gz
timeline-e63f67d335efef91930e274f9703d76e0d363099.tar.bz2
timeline-e63f67d335efef91930e274f9703d76e0d363099.zip
Update CI.
Diffstat (limited to 'azure-pipelines.yml')
-rw-r--r--azure-pipelines.yml76
1 files changed, 76 insertions, 0 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 00000000..6078b1ff
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,76 @@
+trigger:
+- master
+
+stages:
+- stage: build
+ displayName: Routine Build and Test
+
+ jobs:
+ - job: build
+ pool:
+ vmImage: 'ubuntu-18.04'
+ variables:
+ buildConfiguration: 'Debug'
+ ASPNETCORE_ENVIRONMENT: 'Development'
+ steps:
+ - task: UseDotNet@2
+ inputs:
+ packageType: sdk
+ version: 2.2.x
+
+ - script: |
+ dotnet restore Timeline/Timeline.csproj --configfile nuget.config
+ dotnet restore Timeline.Tests/Timeline.Tests.csproj --configfile nuget.config
+ displayName: Dotnet Restore
+
+ - script: dotnet test Timeline.Tests/Timeline.Tests.csproj --configuration $(buildConfiguration) --no-restore --logger trx --collect:"XPlat Code Coverage" --settings './coverletArgs.runsettings'
+ displayName: Dotnet Test
+
+ - task: PublishTestResults@2
+ condition: succeededOrFailed()
+ inputs:
+ testRunner: VSTest
+ testResultsFiles: '**/*.trx'
+
+ - task: PublishCodeCoverageResults@1
+ condition: succeededOrFailed()
+ inputs:
+ codeCoverageTool: 'Cobertura'
+ summaryFileLocation: '**/TestResults/*/coverage.cobertura.xml'
+
+- stage: deploy
+ displayName: Build Release and Deploy
+ variables:
+ buildConfiguration: 'Release'
+
+ jobs:
+ - job: build
+ displayName: Build Release Artifact
+ pool:
+ vmImage: 'ubuntu-18.04'
+ steps:
+ - script: dotnet publish Timeline/Timeline.csproj --configuration $(buildConfiguration) --output ./publish/
+ displayName: Dotnet Publish
+
+ - task: PublishPipelineArtifact@1
+ inputs:
+ artifactName: 'timeline'
+ targetPath: Timeline/publish
+
+ - deployment: deploy
+ displayName: Deploy to Server
+ pool:
+ name: 'Default'
+ environment: 'timeline-server'
+ dependsOn: build
+ strategy:
+ runOnce:
+ deploy:
+ steps:
+ - script: |
+ rm -rf /var/timeline/*
+ cp -r $PIPELINE_WORKSPACE/timeline/. /var/timeline/
+ sudo systemctl restart timeline.service
+ displayName: 'Copy Files and Restart Service'
+ failOnStderr: true
+