137 lines
4.2 KiB
YAML
137 lines
4.2 KiB
YAML
# Starter pipeline
|
|
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
|
# Add steps that build, run tests, deploy, and more:
|
|
# https://aka.ms/yaml
|
|
|
|
name: $(TeamProject)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.rr)
|
|
|
|
# Trigger CI on commit to master branch
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- master
|
|
- zvma-updates
|
|
|
|
# Trigger CI on pull requests to master and develop branches
|
|
pr:
|
|
- master
|
|
- zvma-updates
|
|
|
|
jobs:
|
|
# Windows PowerShell 5.1 Build Job
|
|
- job: Build_PS_Windows
|
|
timeoutInMinutes: 10
|
|
cancelTimeoutInMinutes: 2
|
|
pool:
|
|
vmImage: windows-latest
|
|
steps:
|
|
# Run build.ps1 script in PowerShell Core
|
|
- powershell: |
|
|
.\build.ps1 -Verbose
|
|
displayName: "Build and Test"
|
|
# Upload test results to Azure Pipeline
|
|
- task: PublishTestResults@2
|
|
inputs:
|
|
testRunner: "NUnit"
|
|
testResultsFiles: "**/BuiltTestResults.xml"
|
|
testRunTitle: "PS_Win2016_Built"
|
|
displayName: "Publish Test Results"
|
|
condition: always()
|
|
|
|
# Windows PowerShell Core Build Job
|
|
- job: Build_PSCore_Windows
|
|
timeoutInMinutes: 10
|
|
cancelTimeoutInMinutes: 2
|
|
pool:
|
|
vmImage: windows-latest
|
|
steps:
|
|
# Run build.ps1 script in PowerShell Core
|
|
- pwsh: |
|
|
.\build.ps1 -Verbose
|
|
displayName: "Build and Test"
|
|
# Upload test results to Azure Pipeline
|
|
- task: PublishTestResults@2
|
|
inputs:
|
|
testRunner: "NUnit"
|
|
testResultsFiles: "**/BuiltTestResults.xml"
|
|
testRunTitle: "PSCore_Win2016_Built"
|
|
displayName: "Publish Test Results"
|
|
condition: always()
|
|
# Publish module as an artifact
|
|
- task: PublishBuildArtifacts@1
|
|
inputs:
|
|
PathtoPublish: "publish/ZertoApiWrapper"
|
|
ArtifactName: "ZertoApiWrapper"
|
|
publishLocation: "Container"
|
|
|
|
# Linux Build Job
|
|
- job: Build_PSCore_Ubuntu
|
|
timeoutInMinutes: 10
|
|
cancelTimeoutInMinutes: 2
|
|
pool:
|
|
vmImage: ubuntu-latest
|
|
steps:
|
|
# Run build.ps1 script in PowerShell Core
|
|
- pwsh: |
|
|
.\build.ps1 -verbose
|
|
displayName: "Build and Test"
|
|
# Upload test results to Azure Pipeline
|
|
- task: PublishTestResults@2
|
|
inputs:
|
|
testRunner: "NUnit"
|
|
testResultsFiles: "**/BuiltTestResults.xml"
|
|
testRunTitle: "PSCore_Ubuntu_Built"
|
|
displayName: "Publish Test Results"
|
|
condition: always()
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: "Publish Data"
|
|
inputs:
|
|
artifactName: "ReleaseData"
|
|
targetPath: ./publish
|
|
condition: always()
|
|
|
|
# MacOS Build Job
|
|
- job: Build_PSCore_MacOS
|
|
timeoutInMinutes: 10
|
|
cancelTimeoutInMinutes: 2
|
|
pool:
|
|
vmImage: macOS-latest
|
|
steps:
|
|
# Run build.ps1 script in PowerShell Core
|
|
- pwsh: |
|
|
.\build.ps1 -verbose
|
|
displayName: "Build and Test"
|
|
# Upload test results to Azure Pipeline
|
|
- task: PublishTestResults@2
|
|
inputs:
|
|
testRunner: "NUnit"
|
|
testResultsFiles: "**/BuiltTestResults.xml"
|
|
testRunTitle: "PSCore_MacOS1013_Built"
|
|
displayName: "Publish Test Results"
|
|
condition: always()
|
|
|
|
# Publish Module to Gallery
|
|
- job: Publish
|
|
dependsOn:
|
|
- Build_PS_Windows
|
|
- Build_PSCore_Windows
|
|
- Build_PSCore_Ubuntu
|
|
- Build_PSCore_MacOS
|
|
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/zvma-updates'))
|
|
pool:
|
|
vmImage: 'windows-latest'
|
|
steps:
|
|
# Download the artifact
|
|
- task: DownloadBuildArtifacts@0
|
|
inputs:
|
|
artifactName: 'ZertoApiWrapper' # The name of the artifact you specified in the build job
|
|
downloadPath: '$(Build.ArtifactStagingDirectory)'
|
|
|
|
# Publish the module to the PowerShell Gallery
|
|
- powershell: |
|
|
Install-Module -Name PowerShellGet -Force -Scope CurrentUser
|
|
$env:PSModulePath = "$(Build.ArtifactStagingDirectory);"+$env:PSModulePath
|
|
$apiKey = "$(PowerShellGalleryApiKey)"
|
|
Publish-Module -Path "$(Build.ArtifactStagingDirectory)\ZertoApiWrapper" -NuGetApiKey $apiKey
|
|
displayName: 'Publish to PowerShell Gallery'
|