Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-stage pipelines (to split build->test) #1404

Merged
merged 36 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e7a7c54
try using multi-job yaml with different images
bergmeister Feb 2, 2020
2e4c403
fix indentation
bergmeister Feb 2, 2020
e669e48
add vm images to windows build and templatify unix build. Images now …
bergmeister Feb 2, 2020
ca51510
trigger
bergmeister Feb 2, 2020
ac4894c
fix yaml path
bergmeister Feb 2, 2020
d2188be
disable sporadic tests generally and add both Ubuntu images to the tests
bergmeister Feb 2, 2020
ba896ab
job name in quotes and disable redundant appveyor matrix entries
bergmeister Feb 2, 2020
c50c02a
whitespace not allowed for job name
bergmeister Feb 2, 2020
ec0fcb7
dots arent allowed either...
bergmeister Feb 2, 2020
4afd0c6
last fix
bergmeister Feb 2, 2020
a503c15
Merge all entry path yaml files into one yaml.ci file
bergmeister Feb 2, 2020
e31aead
fix windows powershell job
bergmeister Feb 2, 2020
06d6631
tweak step name for ps5 to be consistent
bergmeister Feb 2, 2020
9c4445b
re-trigger
bergmeister Feb 2, 2020
dfe241a
add badge
bergmeister Feb 2, 2020
58df168
multi stage build-test
Feb 3, 2020
b4ef261
bootstrap pester
Feb 3, 2020
2623e58
Cleanup and avoid Pester bootstrap in build stage
Feb 3, 2020
c7bbb5f
download pipeline artifact in test stage
Feb 3, 2020
270bb78
try fix artifact download path
Feb 3, 2020
db7d529
try fix artifact path using '$(Build.SourcesDirectory)/out' and add d…
Feb 3, 2020
7a13f38
fix ps syntax
Feb 3, 2020
ca2c14c
remove debugging step
Feb 3, 2020
e4717dd
Fix suggestion text to have platform specific newlines and enable tes…
Feb 3, 2020
4459f9e
add more windows images
Feb 3, 2020
c34fb1a
try use strategy
Feb 3, 2020
164bca3
try
Feb 3, 2020
329f712
fix job name
Feb 3, 2020
f5edd4e
rename and try to not use a job name
Feb 3, 2020
5c8bb36
remove pwsh variable, which is now redundant as it is now in test.yaml
Feb 3, 2020
06309b8
remove old comment
Feb 3, 2020
6ff0c07
try fix tests on wmf4
Feb 3, 2020
bb95ab4
try use -be instead of -match operator
Feb 3, 2020
8eaf6fd
fix wmf4 test failure due to CRLF not being correctly used in this ve…
Feb 3, 2020
20e5b1b
Merge branch 'master' of https://github.com/powershell/psscriptanalyz…
Feb 3, 2020
9f81fab
make pscompatiblitycollector build against all frameworks again
Feb 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 43 additions & 47 deletions .azure-pipelines-ci/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,47 @@
variables:
pwsh: true
# Avoid expensive initialization of dotnet cli, see: https://donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1

jobs:
- job: 'Ubuntu_16_04'
pool:
vmImage: ubuntu-16.04
steps:
- template: templates/unix.yaml

- job: 'Ubuntu_18_04'
pool:
vmImage: ubuntu-18.04
steps:
- template: templates/unix.yaml

- job: macOS
pool:
vmImage: macos-latest
steps:
- template: templates/unix.yaml

- job: 'Windows_PowerShell_5_1'
pool:
vmImage: windows-latest
steps:
- powershell: |
Import-Module .\tools\appveyor.psm1
Invoke-AppveyorInstall
./build.ps1 -Configuration 'Release' -PSVersion 5
./PSCompatibilityCollector/build.ps1 -Configuration 'Release' -Framework 'net452'
displayName: 'Build'
- template: templates/test.yaml
parameters:
pwsh: false

- job: 'Windows_PowerShell_Core'
pool:
vmImage: windows-latest
steps:
- pwsh: |
Import-Module .\tools\appveyor.psm1
Invoke-AppveyorInstall
./build.ps1 -Configuration 'Release' -All
./PSCompatibilityCollector/build.ps1 -Configuration 'Release' -Framework 'netstandard2.0'
displayName: 'Full Build'
- template: templates/test.yaml
parameters:
pwsh: true
stages:
- stage: Build
jobs:
- job: 'Full_Build'
pool:
vmImage: windows-latest
steps:
- pwsh: |
Import-Module .\tools\appveyor.psm1
Invoke-AppveyorInstall -SkipPesterInstallation
./build.ps1 -Configuration 'Release' -All
./PSCompatibilityCollector/build.ps1 -Configuration 'Release' -Framework 'netstandard2.0'
bergmeister marked this conversation as resolved.
Show resolved Hide resolved
displayName: 'Full Build'
- task: PublishPipelineArtifact@1
displayName: 'Publish Pipeline Artifact: out Folder'
inputs:
targetPath: '$(Build.SourcesDirectory)/out'
artifactName: out
- stage: Test
jobs:
- job:
strategy:
matrix:
Ubuntu_16_04:
vmImage: ubuntu-16.04
Ubuntu_18_04:
vmImage: ubuntu-18.04
macOS:
vmImage: macos-latest
Windows_Server2016_PowerShell_Core:
vmImage: windows-2019
Windows_Server2019_PowerShell_Core:
vmImage: windows-2019
Windows_Server2016_PowerShell_5_1:
vmImage: vs2017-win2016
pwsh: false
Windows_Server2019_PowerShell_5_1:
vmImage: vs2017-win2016
pwsh: false
pool:
vmImage: $[ variables['vmImage'] ]
steps:
- template: templates/test.yaml
10 changes: 10 additions & 0 deletions .azure-pipelines-ci/templates/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
parameters:
- name: pwsh
type: boolean
default: true

steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact: out Folder'
inputs:
artifactName: out
targetPath: '$(Build.SourcesDirectory)/out'
- task: PowerShell@2
displayName: 'Test'
inputs:
Expand Down
8 changes: 0 additions & 8 deletions .azure-pipelines-ci/templates/unix.yaml

This file was deleted.

7 changes: 3 additions & 4 deletions Rules/MissingModuleManifestField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ private List<CorrectionExtent> GetCorrectionExtent(HashtableAst ast)
Strings.MissingModuleManifestFieldCorrectionDescription,
fieldName,
fieldValue);
var correctionTextTemplate = @"
# Version number of this module.
{0} = '{1}'
";
var correctionTextTemplate = string.Concat(Environment.NewLine,
"# Version number of this module.", Environment.NewLine,
"{0} = '{1}'", Environment.NewLine);
var correctionText = string.Format(
correctionTextTemplate,
fieldName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ Describe "MissingRequiredFieldModuleManifest" {
$violations.SuggestedCorrections.Count | Should -Be $numExpectedCorrections
}

# On Linux, mismatch in line endings cause this to fail
It "has the right suggested correction" -Skip:($IsLinux) {
$expectedText = @'
# Version number of this module.
ModuleVersion = '1.0.0.0'
'@
$violations[0].SuggestedCorrections[0].Text | Should -Match $expectedText
Get-ExtentText $violations[0].SuggestedCorrections[0] $violationFilepath | Should -BeNullOrEmpty
It "has the right suggested correction" {
$expectedText = [System.Environment]::NewLine + '# Version number of this module.' +
[System.Environment]::NewLine + "ModuleVersion = '1.0.0.0'" + [System.Environment]::NewLine

$violations[0].SuggestedCorrections[0].Text | Should -BeExactly $expectedText
Get-ExtentText $violations[0].SuggestedCorrections[0] $violationFilepath | Should -BeNullOrEmpty
}
}

Expand Down
17 changes: 14 additions & 3 deletions tools/appveyor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

$ErrorActionPreference = 'Stop'

# Implements the AppVeyor 'install' step and installs the required versions of Pester, platyPS and the .Net Core SDK if needed.
function Invoke-AppVeyorInstall {
$requiredPesterVersion = '4.4.4'
function Install-Pester {
$requiredPesterVersion = '4.10.0'
$pester = Get-Module Pester -ListAvailable | Where-Object { $_.Version -eq $requiredPesterVersion }
if ($null -eq $pester) {
if ($null -eq (Get-Module -ListAvailable PowershellGet)) {
Expand All @@ -19,6 +18,16 @@ function Invoke-AppVeyorInstall {
Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser -Repository PSGallery
}
}
}

# Implements the AppVeyor 'install' step and installs the required versions of Pester, platyPS and the .Net Core SDK if needed.
function Invoke-AppVeyorInstall {
param(
# For the multi-stage build in Azure DevOps, Pester is not needed for bootstrapping the build environment
[switch] $SkipPesterInstallation
)

if (-not $SkipPesterInstallation.IsPresent) { Install-Pester }

if ($null -eq (Get-Module -ListAvailable PowershellGet)) {
# WMF 4 image build
Expand Down Expand Up @@ -72,6 +81,8 @@ function Invoke-AppveyorTest {
$CheckoutPath
)

Install-Pester

# enforce the language to utf-8 to avoid issues
$env:LANG = "en_US.UTF-8"
Write-Verbose -Verbose ("Running tests on PowerShell version " + $PSVersionTable.PSVersion)
Expand Down