Skip to content

Commit 75891d8

Browse files
committed
Update appveyor scripts to use new build script
1 parent 2978f78 commit 75891d8

File tree

3 files changed

+27
-56
lines changed

3 files changed

+27
-56
lines changed

appveyor.yml

+21-22
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
environment:
2+
PSVersion: 5
3+
BuildConfiguration: Release
24
matrix:
35
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
46
PowerShellEdition: PowerShellCore
5-
BuildConfiguration: Release
67
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
78
PowerShellEdition: WindowsPowerShell
8-
BuildConfiguration: Release
99
- APPVEYOR_BUILD_WORKER_IMAGE: WMF 4
1010
PowerShellEdition: WindowsPowerShell
11-
BuildConfiguration: PSv4Release
11+
PSVersion: 4
1212
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
1313
PowerShellEdition: PowerShellCore
14-
BuildConfiguration: Release
1514

1615
# cache Nuget packages and dotnet CLI cache
1716
cache:
@@ -33,29 +32,29 @@ install:
3332
3433
build_script:
3534
- ps: |
36-
if ($env:PowerShellEdition -eq 'WindowsPowerShell') {
37-
if ($env:BuildConfiguration -eq 'PSv4Release') {
38-
# On WMF$: Also build for v3 to check it builds at least since we do not have a WMF3 image
39-
Invoke-AppveyorBuild -CheckoutPath $env:APPVEYOR_BUILD_FOLDER -BuildConfiguration PSv3Release -BuildType 'FullCLR'
40-
}
41-
Invoke-AppveyorBuild -CheckoutPath $env:APPVEYOR_BUILD_FOLDER -BuildConfiguration $env:BuildConfiguration -BuildType 'FullCLR'
42-
}
35+
Set-Location $env:APPVEYOR_BUILD_FOLDER
36+
./build.ps1 -Documentation
37+
if ( $env:PSVersion -eq "4" ) { # On WMF4: Also build for v3 to check it builds at least since we do not have a WMF3 image
38+
./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion 3 -Framework full
39+
}
40+
./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion "$env:PSVersion" -Framework full
4341
- pwsh: |
44-
if ($env:PowerShellEdition -eq 'PowerShellCore') {
45-
Import-Module .\tools\appveyor.psm1 # Appveyor does not persist pwsh sessions like it does for ps
46-
Invoke-AppveyorBuild -CheckoutPath $env:APPVEYOR_BUILD_FOLDER -BuildConfiguration $env:BuildConfiguration -BuildType 'NetStandard'
47-
}
42+
if ($env:PowerShellEdition -eq 'PowerShellCore') {
43+
Set-Location $env:APPVEYOR_BUILD_FOLDER
44+
./build.ps1 -Documentation
45+
./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion 5 -Framework core
46+
}
4847
4948
test_script:
5049
- ps: |
51-
if ($env:PowerShellEdition -eq 'WindowsPowerShell') {
52-
Invoke-AppveyorTest -CheckoutPath $env:APPVEYOR_BUILD_FOLDER
53-
}
50+
if ($env:PowerShellEdition -eq 'WindowsPowerShell') {
51+
Invoke-AppveyorTest -CheckoutPath $env:APPVEYOR_BUILD_FOLDER
52+
}
5453
- pwsh: |
55-
if ($env:PowerShellEdition -eq 'PowerShellCore') {
56-
Import-Module .\tools\appveyor.psm1 # Appveyor does not persist pwsh sessions like it does for ps
57-
Invoke-AppveyorTest -CheckoutPath $env:APPVEYOR_BUILD_FOLDER
58-
}
54+
if ($env:PowerShellEdition -eq 'PowerShellCore') {
55+
Import-Module .\tools\appveyor.psm1 # Appveyor does not persist pwsh sessions like it does for ps
56+
Invoke-AppveyorTest -CheckoutPath $env:APPVEYOR_BUILD_FOLDER
57+
}
5958
6059
# Upload the project along with test results as a zip archive
6160
on_finish:

build.psm1

-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ function Remove-Build
8787
}
8888
}
8989

90-
9190
# Build documentation using platyPS
9291
function Build-Documentation
9392
{

tools/appveyor.psm1

+6-33
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,28 @@ $ErrorActionPreference = 'Stop'
55

66
# Implements the AppVeyor 'install' step and installs the required versions of Pester, platyPS and the .Net Core SDK if needed.
77
function Invoke-AppVeyorInstall {
8-
$requiredPesterVersion = '4.3.1'
8+
$requiredPesterVersion = '4.4.1'
99
$pester = Get-Module Pester -ListAvailable | Where-Object { $_.Version -eq $requiredPesterVersion }
1010
if ($null -eq $pester) {
1111
if ($null -eq (Get-Module -ListAvailable PowershellGet)) {
1212
# WMF 4 image build
13+
Write-Verbose -Verbose "Installing Pester via nuget"
1314
nuget install Pester -Version $requiredPesterVersion -source https://www.powershellgallery.com/api/v2 -outputDirectory "$env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion
1415
}
1516
else {
1617
# Visual Studio 2017 build (has already Pester v3, therefore a different installation mechanism is needed to make it also use the new version 4)
18+
Write-Verbose -Verbose "Installing Pester via Install-Module"
1719
Install-Module -Name Pester -Force -SkipPublisherCheck -Scope CurrentUser
1820
}
1921
}
2022

2123
if ($null -eq (Get-Module -ListAvailable PowershellGet)) {
2224
# WMF 4 image build
25+
Write-Verbose -Verbose "Installing platyPS via nuget"
2326
nuget install platyPS -Version 0.9.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion
2427
}
2528
else {
29+
Write-Verbose -Verbose "Installing platyPS via Install-Module"
2630
Install-Module -Name platyPS -Force -Scope CurrentUser -RequiredVersion '0.9.0'
2731
}
2832

@@ -37,37 +41,6 @@ function Invoke-AppVeyorInstall {
3741
}
3842
}
3943

40-
# Implements the AppVeyor 'build_script' step
41-
function Invoke-AppVeyorBuild {
42-
Param(
43-
[Parameter(Mandatory)]
44-
[ValidateSet('FullCLR', 'NetStandard')]
45-
$BuildType,
46-
47-
[Parameter(Mandatory)]
48-
[ValidateSet('Release', 'PSv3Release', 'PSv4Release')]
49-
$BuildConfiguration,
50-
51-
[Parameter(Mandatory)]
52-
[ValidateScript( {Test-Path $_})]
53-
$CheckoutPath
54-
)
55-
56-
$PSVersionTable
57-
Write-Verbose "Pester version: $((Get-Command Invoke-Pester).Version)" -Verbose
58-
Write-Verbose ".NET SDK version: $(dotnet --version)" -Verbose
59-
Push-Location $CheckoutPath
60-
[Environment]::SetEnvironmentVariable("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", 1) # avoid unneccessary initialization in CI
61-
if ($BuildType -eq 'FullCLR') {
62-
.\buildCoreClr.ps1 -Framework net451 -Configuration $BuildConfiguration -Build
63-
}
64-
elseif ($BuildType -eq 'NetStandard') {
65-
.\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
66-
}
67-
.\build.ps1 -BuildDocs
68-
Pop-Location
69-
}
70-
7144
# Implements AppVeyor 'test_script' step
7245
function Invoke-AppveyorTest {
7346
Param(
@@ -97,4 +70,4 @@ function Invoke-AppveyorFinish {
9770
# You can add other artifacts here
9871
(Get-ChildItem $zipFile)
9972
) | ForEach-Object { Push-AppveyorArtifact $_.FullName }
100-
}
73+
}

0 commit comments

Comments
 (0)