Skip to content

Commit

Permalink
use multiple jobs instead of stages
Browse files Browse the repository at this point in the history
  • Loading branch information
pim-simons committed Aug 24, 2023
1 parent 0234aab commit 5267068
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 80 deletions.
57 changes: 28 additions & 29 deletions build/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,40 +112,39 @@ stages:
projectName: '$(Project).Tests.Unit'
testName: '$(Project).${{UnitTest.name}}'

- ${{ each IntegrationTest in parameters.IntegrationTests }}:
- stage: IntegrationTests_${{replace(IntegrationTest.name, '.', '_')}}
displayName: Integration Tests - ${{IntegrationTest.name}}
dependsOn: Build
condition: succeeded()
jobs:
- job: RunIntegrationTests
displayName: 'Run integration tests'
strategy:
maxParallel: 1
matrix:
linux:
imageName: ${{ variables['Vm.Linux.Image']}}
windows:
imageName: ${{ variables['Vm.Windows.Image']}}
pool:
vmImage: '$(imageName)'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download build artifacts'
inputs:
artifact: 'Build'
path: '$(Build.SourcesDirectory)'
- template: 'templates/run-pester-tests.yml'
parameters:
projectName: '$(Project).Tests.Integration'
testName: '$(Project).${{IntegrationTest.name}}'
- stage: IntegrationTests
displayName: Integration Tests
dependsOn: Build
condition: succeeded()
jobs:
- ${{ each IntegrationTest in parameters.IntegrationTests }}:
- job: RunIntegrationTests_${{replace(IntegrationTest.name, '.', '_')}}
displayName: 'Run integration tests - ${{IntegrationTest.name}}'
strategy:
maxParallel: 1
matrix:
linux:
imageName: ${{ variables['Vm.Linux.Image']}}
windows:
imageName: ${{ variables['Vm.Windows.Image']}}
pool:
vmImage: '$(imageName)'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download build artifacts'
inputs:
artifact: 'Build'
path: '$(Build.SourcesDirectory)'
- template: 'templates/run-pester-tests.yml'
parameters:
projectName: '$(Project).Tests.Integration'
testName: '$(Project).${{IntegrationTest.name}}'

- stage: ReleaseToMyget
displayName: 'Release to MyGet'
dependsOn:
- UnitTests
- ${{ each IntegrationTest in parameters.IntegrationTests }}:
- IntegrationTests_${{replace(IntegrationTest.name, '.', '_')}}
- IntegrationTests
condition: succeeded()
jobs:
- job: PushToMyGet
Expand Down
100 changes: 49 additions & 51 deletions build/psgallery-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,62 +84,60 @@ stages:
targetPath: '$(Pipeline.Workspace)/build'
artifactName: Build

- ${{ each UnitTest in parameters.UnitTests }}:
- stage: UnitTests_${{replace(UnitTest.name, '.', '_')}}
displayName: Unit Tests - ${{UnitTest.name}}
dependsOn: Build
condition: succeeded()
jobs:
- job: RunUnitTests
displayName: 'Run unit tests'
pool:
vmImage: '$(Vm.Linux.Image)'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download build artifacts'
inputs:
artifact: 'Build'
path: '$(Build.SourcesDirectory)'
- template: 'templates/run-pester-tests.yml'
parameters:
projectName: '$(Project).Tests.Unit'
testName: '$(Project).${{UnitTest.name}}'
- stage: UnitTests
displayName: Unit Tests
dependsOn: Build
condition: succeeded()
jobs:
- ${{ each UnitTest in parameters.UnitTests }}:
- job: RunUnitTests_${{replace(UnitTest.name, '.', '_')}}
displayName: 'Run unit tests - ${{UnitTest.name}}'
pool:
vmImage: '$(Vm.Linux.Image)'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download build artifacts'
inputs:
artifact: 'Build'
path: '$(Build.SourcesDirectory)'
- template: 'templates/run-pester-tests.yml'
parameters:
projectName: '$(Project).Tests.Unit'
testName: '$(Project).${{UnitTest.name}}'

- ${{ each IntegrationTest in parameters.IntegrationTests }}:
- stage: IntegrationTests_${{replace(IntegrationTest.name, '.', '_')}}
displayName: Integration Tests - ${{IntegrationTest.name}}
dependsOn: Build
condition: succeeded()
jobs:
- job: RunIntegrationTests
displayName: 'Run integration tests'
strategy:
maxParallel: 1
matrix:
linux:
imageName: ${{ variables['Vm.Linux.Image']}}
windows:
imageName: ${{ variables['Vm.Windows.Image']}}
pool:
vmImage: '$(imageName)'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download build artifacts'
inputs:
artifact: 'Build'
path: '$(Build.SourcesDirectory)'
- template: 'templates/run-pester-tests.yml'
parameters:
projectName: '$(Project).Tests.Integration'
testName: '$(Project).${{IntegrationTest.name}}'
- stage: IntegrationTests
displayName: Integration Tests
dependsOn: Build
condition: succeeded()
jobs:
- ${{ each IntegrationTest in parameters.IntegrationTests }}:
- job: RunIntegrationTests_${{replace(IntegrationTest.name, '.', '_')}}
displayName: 'Run integration tests - ${{IntegrationTest.name}}'
strategy:
maxParallel: 1
matrix:
linux:
imageName: ${{ variables['Vm.Linux.Image']}}
windows:
imageName: ${{ variables['Vm.Windows.Image']}}
pool:
vmImage: '$(imageName)'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download build artifacts'
inputs:
artifact: 'Build'
path: '$(Build.SourcesDirectory)'
- template: 'templates/run-pester-tests.yml'
parameters:
projectName: '$(Project).Tests.Integration'
testName: '$(Project).${{IntegrationTest.name}}'

- stage: Release
displayName: 'Release to PowerShell Gallery'
dependsOn:
- ${{ each UnitTest in parameters.UnitTests }}:
- UnitTests_${{replace(UnitTest.name, '.', '_')}}
- ${{ each IntegrationTest in parameters.IntegrationTests }}:
- IntegrationTests_${{replace(IntegrationTest.name, '.', '_')}}
- UnitTests
- IntegrationTests
condition: succeeded()
jobs:
- job: PushToNuGet
Expand Down

0 comments on commit 5267068

Please sign in to comment.