From e519553d7b300b648906d84bdac85334212dbdd3 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 14 Mar 2019 18:42:31 +0800 Subject: Use multiple jobs in ci. --- azure-pipelines.yml | 90 +++++++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 41 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1cdf1c3a..35e24b31 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,44 +6,52 @@ trigger: - master -pool: - vmImage: 'Ubuntu-16.04' - -variables: - buildConfiguration: 'Release' - ASPNETCORE_ENVIRONMENT: 'Development' - -steps: -- 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 - 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' - -- script: dotnet publish Timeline/Timeline.csproj --configuration $(buildConfiguration) --output ./publish/ - displayName: Dotnet Publish - -- task: PublishPipelineArtifact@0 - inputs: - artifactName: 'timeline' - targetPath: Timeline/publish +jobs: +- job: FrontEnd + pool: + vmImage: 'Ubuntu-16.04' + steps: + - script: yarn install + 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' + +- job: BackEnd + pool: + vmImage: 'Ubuntu-16.04' + variables: + buildConfiguration: 'Release' + ASPNETCORE_ENVIRONMENT: 'Development' + steps: + - 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' + +- job: Publish + dependsOn: + - FrontEnd + - BackEnd + pool: + vmImage: 'Ubuntu-16.04' + variables: + buildConfiguration: 'Release' + steps: + - script: dotnet publish Timeline/Timeline.csproj --configuration $(buildConfiguration) --output ./publish/ + displayName: Dotnet Publish + - task: PublishPipelineArtifact@0 + inputs: + artifactName: 'timeline' + targetPath: Timeline/publish -- cgit v1.2.3 From d03bc77edbff574dbb3b0206b3c4953b09598beb Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 14 Mar 2019 21:16:33 +0800 Subject: Add cache for node modules. --- azure-pipelines.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 35e24b31..905dffa0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,7 +11,13 @@ jobs: 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 @@ -30,6 +36,11 @@ jobs: 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 @@ -49,6 +60,11 @@ jobs: 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 -- cgit v1.2.3 From 1fc9f877760fa78da57ec22c08c5d6e9e194fafe Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 14 Mar 2019 21:24:00 +0800 Subject: Add feed. --- azure-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 905dffa0..ab4e3486 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,6 +6,9 @@ trigger: - master +variables: + ArtifactFeed: NodeModules + jobs: - job: FrontEnd pool: -- cgit v1.2.3 From ff8a3ceca3c4bfe5b858957e66ed7e8f1719c97e 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 From 891b11eaecc4fad7b1b537c7f7d0b1aac5e622d1 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 14 Mar 2019 23:04:57 +0800 Subject: Remove prod in yarn test. --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a413ffea..cf1a8c2d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -31,7 +31,7 @@ steps: targetfolder: '**/node_modules, !**/node_modules/**/node_modules' vstsFeed: '$(ArtifactFeed)' -- script: yarn run test --prod --no-watch --browsers=ChromeHeadless --reporters junit +- script: yarn run test --no-watch --browsers=ChromeHeadless --reporters junit workingDirectory: Timeline/ClientApp displayName: Angular Test -- cgit v1.2.3 From 7c6e2c080085c004b7c5c3ec23ebf641b2efde90 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 14 Mar 2019 23:13:05 +0800 Subject: Use explicit dotnet restore. --- azure-pipelines.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cf1a8c2d..edeaca8b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -41,7 +41,12 @@ steps: testRunner: JUnit testResultsFiles: '**/TESTS-*.xml' -- script: dotnet test Timeline.Tests/Timeline.Test-CI.csproj --configuration $(buildConfiguration) --configfile nuget.config --logger trx +- script: | + dotnet restore Timeline/Timeline-CI.csproj --configfile nuget.config + dotnet restore Timeline.Tests/Timeline.Test-CI.csproj --configfile nuget.config + displayName: Dotnet Restore + +- script: dotnet test Timeline.Tests/Timeline.Test-CI.csproj --configuration $(buildConfiguration) --no-restore --logger trx displayName: Dotnet Test - task: PublishTestResults@2 @@ -54,7 +59,7 @@ steps: workingDirectory: Timeline/ClientApp displayName: Client App Build -- script: dotnet publish Timeline/Timeline-CI.csproj --configuration $(buildConfiguration) --configfile nuget.config --output ./publish/ +- script: dotnet publish Timeline/Timeline-CI.csproj --configuration $(buildConfiguration) --no-restore --output ./publish/ displayName: Dotnet Publish - task: PublishPipelineArtifact@0 -- cgit v1.2.3 From ca77ab76b5588be4c224985c8337be48ae1d2a79 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 14 Mar 2019 23:36:52 +0800 Subject: Change assembly name of ci project file. Rename test project file. --- Timeline.Tests/Timeline.Test-CI.csproj | 27 --------------------------- Timeline.Tests/Timeline.Tests-CI.csproj | 27 +++++++++++++++++++++++++++ Timeline/Timeline-CI.csproj | 1 + azure-pipelines.yml | 2 +- 4 files changed, 29 insertions(+), 28 deletions(-) delete mode 100644 Timeline.Tests/Timeline.Test-CI.csproj create mode 100644 Timeline.Tests/Timeline.Tests-CI.csproj diff --git a/Timeline.Tests/Timeline.Test-CI.csproj b/Timeline.Tests/Timeline.Test-CI.csproj deleted file mode 100644 index 3639dbf8..00000000 --- a/Timeline.Tests/Timeline.Test-CI.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - netcoreapp2.2 - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - - - - - - - diff --git a/Timeline.Tests/Timeline.Tests-CI.csproj b/Timeline.Tests/Timeline.Tests-CI.csproj new file mode 100644 index 00000000..3639dbf8 --- /dev/null +++ b/Timeline.Tests/Timeline.Tests-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 index e8d35b1d..65bfacdf 100644 --- a/Timeline/Timeline-CI.csproj +++ b/Timeline/Timeline-CI.csproj @@ -8,6 +8,7 @@ ClientApp\ $(DefaultItemExcludes);$(SpaRoot)node_modules\** crupest + Timeline diff --git a/azure-pipelines.yml b/azure-pipelines.yml index edeaca8b..cdb68efb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -46,7 +46,7 @@ steps: dotnet restore Timeline.Tests/Timeline.Test-CI.csproj --configfile nuget.config displayName: Dotnet Restore -- script: dotnet test Timeline.Tests/Timeline.Test-CI.csproj --configuration $(buildConfiguration) --no-restore --logger trx +- script: dotnet test Timeline.Tests/Timeline.Tests-CI.csproj --configuration $(buildConfiguration) --no-restore --logger trx displayName: Dotnet Test - task: PublishTestResults@2 -- cgit v1.2.3 From 723bbf776ff902abd61e7bc354b77b178777324d Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 14 Mar 2019 23:44:08 +0800 Subject: Fix a bug! --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cdb68efb..17087351 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,7 +43,7 @@ steps: - script: | dotnet restore Timeline/Timeline-CI.csproj --configfile nuget.config - dotnet restore Timeline.Tests/Timeline.Test-CI.csproj --configfile nuget.config + dotnet restore Timeline.Tests/Timeline.Tests-CI.csproj --configfile nuget.config displayName: Dotnet Restore - script: dotnet test Timeline.Tests/Timeline.Tests-CI.csproj --configuration $(buildConfiguration) --no-restore --logger trx -- cgit v1.2.3