From 5158785a69a6305c4ed8ec9c3403e3e1bd6cf79d Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 14 Mar 2019 23:01:19 +0800 Subject: Optimize. Get rid of repeated yarn install. --- Timeline.Tests/Timeline.Test-CI.csproj | 27 ++++++++ Timeline/Timeline-CI.csproj | 34 ++++++++++ azure-pipelines.yml | 113 +++++++++++++++------------------ 3 files changed, 111 insertions(+), 63 deletions(-) create mode 100644 Timeline.Tests/Timeline.Test-CI.csproj create mode 100644 Timeline/Timeline-CI.csproj diff --git a/Timeline.Tests/Timeline.Test-CI.csproj b/Timeline.Tests/Timeline.Test-CI.csproj new file mode 100644 index 00000000..3639dbf8 --- /dev/null +++ b/Timeline.Tests/Timeline.Test-CI.csproj @@ -0,0 +1,27 @@ + + + + netcoreapp2.2 + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + + diff --git a/Timeline/Timeline-CI.csproj b/Timeline/Timeline-CI.csproj new file mode 100644 index 00000000..e8d35b1d --- /dev/null +++ b/Timeline/Timeline-CI.csproj @@ -0,0 +1,34 @@ + + + + netcoreapp2.2 + true + Latest + false + ClientApp\ + $(DefaultItemExcludes);$(SpaRoot)node_modules\** + crupest + + + + + + + + + + + + + + + + + + %(DistFiles.Identity) + PreserveNewest + + + + + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ab4e3486..a413ffea 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,69 +8,56 @@ trigger: variables: ArtifactFeed: NodeModules + buildConfiguration: 'Release' + ASPNETCORE_ENVIRONMENT: 'Development' -jobs: -- job: FrontEnd - pool: - vmImage: 'Ubuntu-16.04' - steps: - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreAndSaveCacheV1.RestoreAndSaveCache@1 - inputs: - keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' - - script: yarn install - condition: ne(variables['CacheRestored'], 'true') - workingDirectory: Timeline/ClientApp - displayName: Yarn Install - - script: yarn run test --no-watch --browsers=ChromeHeadless --reporters junit - workingDirectory: Timeline/ClientApp - displayName: Angular Test - - task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testRunner: JUnit - testResultsFiles: '**/TESTS-*.xml' +pool: + vmImage: 'Ubuntu-16.04' +steps: +- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1 + inputs: + keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: '$(ArtifactFeed)' -- job: BackEnd - pool: - vmImage: 'Ubuntu-16.04' - variables: - buildConfiguration: 'Release' - ASPNETCORE_ENVIRONMENT: 'Development' - steps: - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreAndSaveCacheV1.RestoreAndSaveCache@1 - inputs: - keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' - - script: dotnet build --configuration $(buildConfiguration) --configfile nuget.config - displayName: Dotnet Build - - script: dotnet test Timeline.Tests --configuration $(buildConfiguration) --logger trx - displayName: Dotnet Test - - task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testRunner: VSTest - testResultsFiles: '**/*.trx' +- script: yarn install --non-interactive + condition: ne(variables['CacheRestored'], 'true') + workingDirectory: Timeline/ClientApp + displayName: Yarn Install -- job: Publish - dependsOn: - - FrontEnd - - BackEnd - pool: - vmImage: 'Ubuntu-16.04' - variables: - buildConfiguration: 'Release' - steps: - - task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreAndSaveCacheV1.RestoreAndSaveCache@1 - inputs: - keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' - targetfolder: '**/node_modules, !**/node_modules/**/node_modules' - vstsFeed: '$(ArtifactFeed)' - - script: dotnet publish Timeline/Timeline.csproj --configuration $(buildConfiguration) --output ./publish/ - displayName: Dotnet Publish - - task: PublishPipelineArtifact@0 - inputs: - artifactName: 'timeline' - targetPath: Timeline/publish +- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1 + inputs: + keyfile: '**/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock' + targetfolder: '**/node_modules, !**/node_modules/**/node_modules' + vstsFeed: '$(ArtifactFeed)' + +- script: yarn run test --prod --no-watch --browsers=ChromeHeadless --reporters junit + workingDirectory: Timeline/ClientApp + displayName: Angular Test + +- task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testRunner: JUnit + testResultsFiles: '**/TESTS-*.xml' + +- script: dotnet test Timeline.Tests/Timeline.Test-CI.csproj --configuration $(buildConfiguration) --configfile nuget.config --logger trx + displayName: Dotnet Test + +- task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testRunner: VSTest + testResultsFiles: '**/*.trx' + +- script: yarn build --prod + workingDirectory: Timeline/ClientApp + displayName: Client App Build + +- script: dotnet publish Timeline/Timeline-CI.csproj --configuration $(buildConfiguration) --configfile nuget.config --output ./publish/ + displayName: Dotnet Publish + +- task: PublishPipelineArtifact@0 + inputs: + artifactName: 'timeline' + targetPath: Timeline/publish -- cgit v1.2.3