Use latest PDK fixing acceptance tests #413
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
pdk_version: 3.0.0 | |
module_cache: PSFramework, PSDscResources, AccessControlDSC, powershell-yaml, PSScriptAnalyzer | |
COVERAGE_ENABLED: 'yes' | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
defaults: | |
run: | |
shell: powershell | |
jobs: | |
acceptance: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2022] | |
tag: [Basic] | |
pwshlib_source: [forge, git] | |
include: | |
- pwshlib_source: forge | |
pwshlib_repo: "puppetlabs/pwshlib" | |
pwshlib_ref: "latest" # Change to a specific version if desired | |
results_file: Acceptance.Forge.Results.xml | |
- pwshlib_source: git | |
pwshlib_repo: "https://github.com/puppetlabs/ruby-pwsh.git" # Change to another fork if desired | |
pwshlib_ref: main # Change to another branch if desired | |
results_file: Acceptance.Git.Results.xml | |
steps: | |
- name: "checkout" | |
uses: actions/checkout@v3 | |
- name: "install modules" | |
uses: potatoqualitee/[email protected] | |
with: | |
shell: powershell | |
modules-to-cache: ${{ env.module_cache }} | |
- name: Install winget | |
uses: Cyberboss/install-winget@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "install pdk" | |
run: | | |
winget install pdk --version=3.0.1 --silent | |
# choco feature disable -n=showDownloadProgress | |
# choco install pdk --version ${{ env.pdk_version }} -y | |
# echo "C:\Program Files\Puppet Labs\DevelopmentKit\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 | |
# refreshenv | |
- name: "configure winrm" | |
run: | | |
Write-Host 'Ensuring WinRM is configured for DSC' | |
Get-ChildItem WSMan:\localhost\Listener\ -OutVariable Listeners | Format-List * -Force | |
$HTTPListener = $Listeners | Where-Object -FilterScript { $_.Keys.Contains('Transport=HTTP') } | |
If ($HTTPListener.Count -eq 0) { | |
winrm create winrm/config/Listener?Address=*+Transport=HTTP | |
winrm e winrm/config/listener | |
} | |
# - name: Install Winget | |
# run: | | |
# winget --help | |
# # winget || iwr -useb https://aka.ms/winget/install | iex | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0.6 | |
# - name: "setup pre-requisite native gems" | |
# run: | | |
# refreshenv | |
# Get-Command pdk | |
# pdk --version | |
# gem install racc -v '~> 1.4.0' | |
# gem install nkf -v '~> 0.2.0' | |
# # pdk bundle exec gem install racc -v '~> 1.4.0' | |
# # pdk bundle exec gem install nkf -v '~> 0.2.0' | |
- name: "test" | |
run: | | |
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 | |
refreshenv | |
Import-Module -Name PSDesiredStateConfiguration -Force | |
Import-Module -Name .\src\Puppet.Dsc\puppet.dsc.psd1 -Force | |
$null = Get-Command -Module Puppet.Dsc | |
$ErrorActionPreference = "Stop" | |
$TestParameters = @{ | |
TestPath = @((Resolve-Path .\acceptance)) | |
ResultsPath = "${{ matrix.results_file }}" | |
Tag = "${{ matrix.tag }}" | |
PwshLibSource = "${{ matrix.pwshlib_source }}" | |
PwshLibRepo = "${{ matrix.pwshlib_repo }}" | |
PwshLibReference = "${{ matrix.pwshlib_ref }}" | |
} | |
$Results = .\scripts\invoke_tests.ps1 @TestParameters | |
if ($Results.FailedCount -gt 0) { | |
throw "$($Results.FailedCount) tests failed." | |
} |