Skip to content

Commit 5c01978

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

File tree

3 files changed

+32
-59
lines changed

3 files changed

+32
-59
lines changed

appveyor.yml

Lines changed: 21 additions & 22 deletions
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ function Remove-Build
8787
}
8888
}
8989

90-
9190
# Build documentation using platyPS
9291
function Build-Documentation
9392
{
9493
$docsPath = Join-Path $projectRoot docs
9594
$markdownDocsPath = Join-Path $docsPath markdown
9695
$outputDocsPath = Join-Path $destinationDir en-US
9796
$requiredVersionOfplatyPS = 0.9
98-
$modInfo = new-object Microsoft.PowerShell.Commands.ModuleSpecification -ArgumentList @{ ModuleName = "platyps"; ModuleVersion = $requiredVersionOfplatyPS}
99-
if ( $null -eq (Get-Module -ListAvailable -FullyQualifiedName $modInfo))
97+
#$modInfo = new-object Microsoft.PowerShell.Commands.ModuleSpecification -ArgumentList @{ ModuleName = "platyps"; ModuleVersion = $requiredVersionOfplatyPS}
98+
#if ( $null -eq (Get-Module -ListAvailable -FullyQualifiedName $modInfo))
99+
if ( $null -eq (Get-Module -ListAvailable platyPS))
100100
{
101101
throw "Cannot find required minimum version $requiredVersionOfplatyPS of platyPS. Install via 'Install-Module platyPS'"
102102
}

tools/appveyor.psm1

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,69 +5,43 @@ $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

2933
# the legacy WMF4 image only has the old preview SDKs of dotnet
3034
$globalDotJson = Get-Content (Join-Path $PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json
3135
$dotNetCoreSDKVersion = $globalDotJson.sdk.version
32-
if (-not ((dotnet --version).StartsWith($dotNetCoreSDKVersion))) {
36+
# don't try to run this script on linux - we have to do the negative check because IsLinux will be defined in core, but not windows
37+
if (-not ((dotnet --version).StartsWith($dotNetCoreSDKVersion)) -and ! $IsLinux ) {
3338
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # https://github.com/dotnet/announcements/issues/77
3439
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1
3540
.\dotnet-install.ps1 -Version $dotNetCoreSDKVersion
3641
Remove-Item .\dotnet-install.ps1
3742
}
3843
}
3944

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-
7145
# Implements AppVeyor 'test_script' step
7246
function Invoke-AppveyorTest {
7347
Param(
@@ -97,4 +71,4 @@ function Invoke-AppveyorFinish {
9771
# You can add other artifacts here
9872
(Get-ChildItem $zipFile)
9973
) | ForEach-Object { Push-AppveyorArtifact $_.FullName }
100-
}
74+
}

0 commit comments

Comments
 (0)