From e63f67d335efef91930e274f9703d76e0d363099 Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Thu, 17 Oct 2019 13:25:28 +0800 Subject: Update CI. --- CI/build-pipeline.yml | 35 ----------------------- CI/release-pipeline.yml | 53 ---------------------------------- azure-pipelines.yml | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 88 deletions(-) delete mode 100644 CI/build-pipeline.yml delete mode 100644 CI/release-pipeline.yml create mode 100644 azure-pipelines.yml diff --git a/CI/build-pipeline.yml b/CI/build-pipeline.yml deleted file mode 100644 index 85b373ff..00000000 --- a/CI/build-pipeline.yml +++ /dev/null @@ -1,35 +0,0 @@ -trigger: -- master - -variables: - buildConfiguration: 'Debug' - ASPNETCORE_ENVIRONMENT: 'Development' - -pool: - vmImage: 'Ubuntu-16.04' - -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' diff --git a/CI/release-pipeline.yml b/CI/release-pipeline.yml deleted file mode 100644 index f3434a36..00000000 --- a/CI/release-pipeline.yml +++ /dev/null @@ -1,53 +0,0 @@ -trigger: -- master - -pr: none - -stages: -- stage: Build - variables: - buildConfiguration: 'Release' - ASPNETCORE_ENVIRONMENT: 'Development' - 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 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 + -- cgit v1.2.3