build with powershell 5 and 7

This commit is contained in:
Petri Asikainen 2021-06-15 14:09:59 +03:00
parent 8ec56d8e7f
commit b19aa28e41
3 changed files with 43 additions and 15 deletions

View file

@ -88,15 +88,14 @@ task GitStatus -If (Test-Path .git) {
} }
} }
task TestVersions TestPS3, TestPS4, TestPS4, TestPS5 task TestVersions TestPS
task TestPS3 {
exec {powershell.exe -Version 3 -NoProfile Invoke-Build PesterTests} task TestPS {
} if($env:PShell -eq '7') {
task TestPS4 { exec {pwsh.exe -NoProfile Invoke-Build PesterTests}
exec {powershell.exe -Version 4 -NoProfile Invoke-Build PesterTests} }else {
} exec {powershell.exe -NoProfile Invoke-Build PesterTests}
task TestPS5 { }
exec {powershell.exe -Version 5 -NoProfile Invoke-Build PesterTests}
} }
# Synopsis: Invoke Pester Tests # Synopsis: Invoke Pester Tests

View file

@ -33,7 +33,7 @@ Copyright = '(c) 2017 Stephen Maunder. All rights reserved.'
Description = 'Powershell API for Snipeit Asset Management' Description = 'Powershell API for Snipeit Asset Management'
# Minimum version of the Windows PowerShell engine required by this module # Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '3.0' PowerShellVersion = '5.1'
# Name of the Windows PowerShell host required by this module # Name of the Windows PowerShell host required by this module
# PowerShellHostName = '' # PowerShellHostName = ''

View file

@ -7,12 +7,15 @@
# #
############################################################ ############################################################
# This tells AppVeyor that we need WMF 5 and PowerShell 5.0 # powershell core and 5.1
os: WMF 5 image:
- Visual Studio 2017
- Visual Studio 2019
environment: environment:
PSGalleryAPIKey: PSGalleryAPIKey:
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
PShell: '5'
version: 1.7.{build} version: 1.7.{build}
@ -53,15 +56,41 @@ before_build:
build_script: build_script:
- ps: Invoke-Build -Task Build - ps: Invoke-Build -Task Build
# after_build:
# - cmd: mdspell %releasePath%\**/*.md --ignore-numbers --ignore-acronyms --report
test_script: test_script:
- ps: Invoke-Build -Task Test - ps: Invoke-Build -Task Test
before_deploy: before_deploy:
- ps: Invoke-Build -Task Deploy - ps: Invoke-Build -Task Deploy
#Build with powershell core
for:
-
matrix:
only:
- image: Visual Studio 2019
environment:
- PShell: '7'
install:
- pwsh: |
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
Install-Module InvokeBuild -Scope CurrentUser -Force
Install-Module BuildHelpers -Scope CurrentUser -Force
Install-Module platyPS -Scope CurrentUser -Force
Install-Module Pester -Scope CurrentUser -Force
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
$env:releasePath = "$($pwd.Path)\Release"
before_build:
- pwsh: Invoke-Build -Task ShowDebug
build_script:
- pwsh: Invoke-Build -Task Build
test_script:
- pwsh: Invoke-Build -Task Test
before_deploy:
- pwsh: Invoke-Build -Task Deploy
deploy: deploy:
provider: GitHub provider: GitHub
release: v$(appveyor_build_version) release: v$(appveyor_build_version)