-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93a0898
commit 6004255
Showing
12 changed files
with
698 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
# Azure DevOps | ||
# CI pipeline for PSDocs.Azure | ||
|
||
variables: | ||
version: '0.1.0' | ||
buildConfiguration: 'Release' | ||
disable.coverage.autogenerate: 'true' | ||
imageName: 'ubuntu-18.04' | ||
|
||
# Use build number format, i.e. 0.18.0-B2008001 | ||
name: $(version)-B$(date:yyMM)$(rev:rrr) | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- 'main' | ||
tags: | ||
include: | ||
- 'v0.*' | ||
|
||
pr: | ||
branches: | ||
include: | ||
- 'main' | ||
|
||
stages: | ||
|
||
# Build pipeline | ||
- stage: Build | ||
displayName: Build | ||
dependsOn: [] | ||
jobs: | ||
- job: | ||
pool: | ||
vmImage: $(imageName) | ||
displayName: 'Module' | ||
steps: | ||
|
||
# Install pipeline dependencies | ||
- powershell: ./.azure-pipelines/pipeline-deps.ps1 | ||
displayName: 'Install dependencies' | ||
|
||
# Build module | ||
- powershell: Invoke-Build -Configuration $(buildConfiguration) -Build $(Build.BuildNumber) | ||
displayName: 'Build module' | ||
|
||
# DotNet test results | ||
- task: PublishTestResults@2 | ||
displayName: 'Publish unit test results' | ||
inputs: | ||
testRunTitle: 'DotNet on $(imageName)' | ||
testRunner: VSTest | ||
testResultsFiles: 'reports/*.trx' | ||
mergeTestResults: true | ||
platform: $(imageName) | ||
configuration: $(buildConfiguration) | ||
publishRunAttachments: true | ||
condition: succeededOrFailed() | ||
|
||
# PSRule results | ||
- task: PublishTestResults@2 | ||
displayName: 'Publish PSRule results' | ||
inputs: | ||
testRunTitle: 'PSRule on $(imageName)' | ||
testRunner: NUnit | ||
testResultsFiles: 'reports/ps-rule*.xml' | ||
mergeTestResults: true | ||
platform: $(imageName) | ||
configuration: $(buildConfiguration) | ||
publishRunAttachments: true | ||
condition: succeededOrFailed() | ||
|
||
# Generate artifacts | ||
- publish: out/modules/PSDocs.Azure | ||
displayName: 'Publish module' | ||
artifact: PSDocs.Azure | ||
|
||
# Analysis pipeline | ||
- stage: Analysis | ||
displayName: Analysis | ||
dependsOn: [] | ||
variables: | ||
skipComponentGovernanceDetection: true | ||
jobs: | ||
|
||
- job: Secret_Scan | ||
pool: 'Hosted VS2017' | ||
displayName: Secret scan | ||
steps: | ||
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 | ||
displayName: 'Scan for secrets' | ||
inputs: | ||
debugMode: false | ||
toolMajorVersion: V2 | ||
|
||
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2 | ||
displayName: 'Publish scan logs' | ||
continueOnError: true | ||
|
||
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@1 | ||
displayName: 'Check for failures' | ||
inputs: | ||
CredScan: true | ||
ToolLogsNotFoundAction: Error | ||
|
||
# Test pipeline | ||
- stage: Test | ||
dependsOn: Build | ||
jobs: | ||
|
||
- template: jobs/test.yaml | ||
parameters: | ||
name: ubuntu_18_04_coverage | ||
imageName: 'ubuntu-18.04' | ||
displayName: 'PowerShell coverage' | ||
coverage: 'true' | ||
publishResults: 'false' | ||
|
||
- template: jobs/test.yaml | ||
parameters: | ||
name: macOS_10_15 | ||
displayName: 'PowerShell 7.0 - macOS-10.15' | ||
imageName: 'macOS-10.15' | ||
|
||
- template: jobs/test.yaml | ||
parameters: | ||
name: windows | ||
displayName: 'PowerShell 5.1 - win2016' | ||
imageName: 'vs2017-win2016' | ||
|
||
- template: jobs/testContainer.yaml | ||
parameters: | ||
name: ps_7_ubuntu_18_04 | ||
displayName: 'PowerShell 7.0 - ubuntu-18.04' | ||
imageName: mcr.microsoft.com/powershell | ||
imageTag: 7.0.3-ubuntu-18.04 | ||
|
||
- template: jobs/testContainer.yaml | ||
parameters: | ||
name: ps_7_1_ubuntu_18_04 | ||
displayName: 'PowerShell 7.1 - ubuntu-18.04' | ||
imageName: mcr.microsoft.com/powershell | ||
imageTag: 7.1.0-ubuntu-18.04 | ||
|
||
- template: jobs/testContainer.yaml | ||
parameters: | ||
name: ps_6_ubuntu_18_04 | ||
displayName: 'PowerShell 6.2 - ubuntu-18.04' | ||
imageName: mcr.microsoft.com/powershell | ||
imageTag: 6.2.4-ubuntu-18.04 | ||
|
||
# Release pipeline | ||
- stage: Release | ||
displayName: Release | ||
dependsOn: [ 'Test', 'Analysis' ] | ||
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v0.')) | ||
jobs: | ||
- job: | ||
displayName: Live | ||
pool: | ||
vmImage: $(imageName) | ||
variables: | ||
isPreRelease: $[contains(variables['Build.SourceBranchName'], '-B')] | ||
steps: | ||
|
||
# Download module from build | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download module' | ||
inputs: | ||
artifact: PSDocs.Azure | ||
path: $(Build.SourcesDirectory)/out/modules/PSDocs.Azure | ||
|
||
# Install pipeline dependencies | ||
- powershell: ./.azure-pipelines/pipeline-deps.ps1 | ||
displayName: 'Install dependencies' | ||
|
||
# Install pipeline dependencies and build module | ||
- powershell: Invoke-Build Release -ApiKey $(apiKey) | ||
displayName: 'Publish module' | ||
|
||
# Update GitHub release | ||
- task: GitHubRelease@1 | ||
displayName: 'GitHub release' | ||
inputs: | ||
gitHubConnection: 'AzureDevOps-PSDocs.Azure' | ||
repositoryName: '$(Build.Repository.Name)' | ||
action: edit | ||
tag: '$(Build.SourceBranchName)' | ||
releaseNotesSource: inline | ||
releaseNotesInline: 'See [change log](https://github.com/Azure/PSDocs.Azure/blob/main/CHANGELOG.md)' | ||
assetUploadMode: replace | ||
addChangeLog: false | ||
isPreRelease: $(isPreRelease) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Azure DevOps | ||
# CI job for running VM pipelines | ||
|
||
parameters: | ||
name: '' | ||
displayName: '' | ||
buildConfiguration: 'Release' | ||
imageName: '' | ||
coverage: 'false' | ||
publishResults: 'true' | ||
|
||
jobs: | ||
- job: ${{ parameters.name }} | ||
displayName: ${{ parameters.displayName }} | ||
pool: | ||
vmImage: ${{ parameters.imageName }} | ||
variables: | ||
COVERAGE: ${{ parameters.coverage }} | ||
PUBLISHRESULTS: ${{ parameters.publishResults }} | ||
skipComponentGovernanceDetection: true | ||
steps: | ||
|
||
# Install pipeline dependencies | ||
- powershell: ./.azure-pipelines/pipeline-deps.ps1 | ||
displayName: 'Install dependencies' | ||
|
||
# Download module | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download module' | ||
inputs: | ||
artifact: PSDocs.Azure | ||
path: $(Build.SourcesDirectory)/out/modules/PSDocs.Azure | ||
|
||
# Build module | ||
- powershell: Invoke-Build TestModule -Configuration ${{ parameters.buildConfiguration }} -Build $(Build.BuildNumber) | ||
env: | ||
COVERAGE: ${{ parameters.coverage }} | ||
displayName: 'Test module' | ||
|
||
# Pester test results | ||
- task: PublishTestResults@2 | ||
displayName: 'Publish Pester results' | ||
inputs: | ||
testRunTitle: 'Pester on ${{ parameters.imageName }}' | ||
testRunner: NUnit | ||
testResultsFiles: 'reports/pester-unit.xml' | ||
mergeTestResults: true | ||
platform: ${{ parameters.name }} | ||
configuration: ${{ parameters.buildConfiguration }} | ||
publishRunAttachments: true | ||
condition: and(succeededOrFailed(), eq(variables['PUBLISHRESULTS'], 'true')) | ||
|
||
# Generate Code Coverage report | ||
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4 | ||
displayName: 'Code coverage report generator' | ||
inputs: | ||
reports: 'reports/pester-coverage.xml' | ||
targetdir: 'reports/coverage' | ||
sourcedirs: 'src/PSDocs.Azure' | ||
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;SonarQube;Badges' | ||
tag: $(Build.BuildNumber) | ||
condition: eq(variables['COVERAGE'], 'true') | ||
|
||
# Publish Code Coverage report | ||
- task: PublishCodeCoverageResults@1 | ||
displayName: 'Publish Pester code coverage' | ||
inputs: | ||
codeCoverageTool: 'Cobertura' | ||
summaryFileLocation: 'reports/coverage/Cobertura.xml' | ||
reportDirectory: 'reports/coverage' | ||
condition: eq(variables['COVERAGE'], 'true') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Azure DevOps | ||
# CI job for running container pipelines | ||
|
||
parameters: | ||
name: '' | ||
displayName: '' | ||
buildConfiguration: 'Release' | ||
vmImage: 'ubuntu-16.04' | ||
imageName: '' | ||
imageTag: '' | ||
coverage: 'false' | ||
publishResults: 'true' | ||
|
||
jobs: | ||
- job: ${{ parameters.name }} | ||
displayName: ${{ parameters.displayName }} | ||
pool: | ||
vmImage: ${{ parameters.vmImage }} | ||
container: | ||
image: '${{ parameters.imageName }}:${{ parameters.imageTag }}' | ||
env: | ||
COVERAGE: ${{ parameters.coverage }} | ||
PUBLISHRESULTS: ${{ parameters.publishResults }} | ||
variables: | ||
COVERAGE: ${{ parameters.coverage }} | ||
PUBLISHRESULTS: ${{ parameters.publishResults }} | ||
skipComponentGovernanceDetection: true | ||
steps: | ||
|
||
# Install pipeline dependencies | ||
- powershell: ./.azure-pipelines/pipeline-deps.ps1 | ||
displayName: 'Install dependencies' | ||
|
||
# Download module | ||
- task: DownloadPipelineArtifact@2 | ||
displayName: 'Download module' | ||
inputs: | ||
artifact: PSDocs.Azure | ||
path: $(Build.SourcesDirectory)/out/modules/PSDocs.Azure | ||
|
||
# Build module | ||
- powershell: Invoke-Build TestModule -Configuration ${{ parameters.buildConfiguration }} -Build $(Build.BuildNumber) | ||
displayName: 'Test module' | ||
|
||
# Pester test results | ||
- task: PublishTestResults@2 | ||
displayName: 'Publish Pester results' | ||
inputs: | ||
testRunTitle: 'Pester on ${{ parameters.imageTag }}' | ||
testRunner: NUnit | ||
testResultsFiles: 'reports/pester-unit.xml' | ||
mergeTestResults: true | ||
platform: ${{ parameters.imageTag }} | ||
configuration: ${{ parameters.buildConfiguration }} | ||
publishRunAttachments: true | ||
condition: and(succeededOrFailed(), eq(variables['PUBLISHRESULTS'], 'true')) | ||
|
||
# Generate Code Coverage report | ||
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4 | ||
displayName: 'Code coverage report generator' | ||
inputs: | ||
reports: 'reports\pester-coverage.xml' | ||
targetdir: 'reports\coverage' | ||
sourcedirs: 'src\PSDocs.Azure' | ||
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;SonarQube;Badges' | ||
tag: $(Build.BuildNumber) | ||
condition: eq(variables['COVERAGE'], 'true') | ||
|
||
# Publish Code Coverage report | ||
- task: PublishCodeCoverageResults@1 | ||
displayName: 'Publish Pester code coverage' | ||
inputs: | ||
codeCoverageTool: 'Cobertura' | ||
summaryFileLocation: 'reports/coverage/Cobertura.xml' | ||
reportDirectory: 'reports/coverage' | ||
condition: eq(variables['COVERAGE'], 'true') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
# | ||
# Install dependencies for integration with Azure DevOps | ||
# | ||
|
||
if ($Env:SYSTEM_DEBUG -eq 'true') { | ||
$VerbosePreference = 'Continue'; | ||
} | ||
|
||
if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) { | ||
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser; | ||
} | ||
|
||
if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.1 -ErrorAction Ignore)) { | ||
Install-Module PowerShellGet -MinimumVersion 2.2.1 -Scope CurrentUser -Force -AllowClobber; | ||
} | ||
|
||
if ($Null -eq (Get-InstalledModule -Name InvokeBuild -MinimumVersion 5.4.0 -ErrorAction Ignore)) { | ||
Install-Module InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.