From 246e4eafeb10a26e049d1905c9721c1fb1181aed Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Mon, 29 Jul 2019 20:38:31 +0800 Subject: Separate build and release CI. --- CI/build-pipeline.yml | 24 ++++++++++++++++++++++ CI/release-pipeline.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ azure-pipelines.yml | 51 ----------------------------------------------- 3 files changed, 77 insertions(+), 51 deletions(-) create mode 100644 CI/build-pipeline.yml create mode 100644 CI/release-pipeline.yml delete mode 100644 azure-pipelines.yml diff --git a/CI/build-pipeline.yml b/CI/build-pipeline.yml new file mode 100644 index 00000000..33a75a95 --- /dev/null +++ b/CI/build-pipeline.yml @@ -0,0 +1,24 @@ +variables: + buildConfiguration: 'Debug' + ASPNETCORE_ENVIRONMENT: 'Development' +stages: +- stage: Build + jobs: + - job: Build + pool: + vmImage: 'Ubuntu-16.04' + steps: + - 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 + displayName: Dotnet Test + + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testRunner: VSTest + testResultsFiles: '**/*.trx' + diff --git a/CI/release-pipeline.yml b/CI/release-pipeline.yml new file mode 100644 index 00000000..f2b94224 --- /dev/null +++ b/CI/release-pipeline.yml @@ -0,0 +1,53 @@ +trigger: +- master + +pr: none + +variables: + buildConfiguration: 'Release' + ASPNETCORE_ENVIRONMENT: 'Production' +stages: +- stage: Build + jobs: + - job: Build + pool: + vmImage: 'Ubuntu-16.04' + steps: + - 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 + displayName: Dotnet Test + + - task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testRunner: VSTest + testResultsFiles: '**/*.trx' + + - script: dotnet publish Timeline/Timeline.csproj --configuration $(buildConfiguration) --no-restore --output ./publish/ + displayName: Dotnet Publish + + - task: PublishPipelineArtifact@0 + inputs: + artifactName: 'timeline' + targetPath: Timeline/publish + +- stage: Deploy + jobs: + - deployment: Deploy + pool: + name: 'Default' + environment: 'timeline-server' + strategy: + runOnce: + deploy: + steps: + - script: | + rm -rf /var/timeline/* + cp -r $PIPELINE_WORKSPACE/timeline/. /var/timeline/ + sudo systemctl restart timeline.service + displayName: 'Command Line Script' + failOnStderr: true diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index b27b3112..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,51 +0,0 @@ -trigger: -- master - -variables: - buildConfiguration: 'Release' - ASPNETCORE_ENVIRONMENT: 'Development' -stages: -- stage: Build - jobs: - - job: Build - pool: - vmImage: 'Ubuntu-16.04' - steps: - - 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 - displayName: Dotnet Test - - - task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testRunner: VSTest - testResultsFiles: '**/*.trx' - - - script: dotnet publish Timeline/Timeline.csproj --configuration $(buildConfiguration) --no-restore --output ./publish/ - displayName: Dotnet Publish - - - task: PublishPipelineArtifact@0 - inputs: - artifactName: 'timeline' - targetPath: Timeline/publish - -- stage: Deploy - jobs: - - deployment: Deploy - pool: - name: 'Default' - environment: 'timeline-server' - strategy: - runOnce: - deploy: - steps: - - script: | - rm -rf /var/timeline/* - cp -r $PIPELINE_WORKSPACE/timeline/. /var/timeline/ - sudo systemctl restart timeline.service - displayName: 'Command Line Script' - failOnStderr: true -- cgit v1.2.3