pr #25
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: | |
pull_request: | |
branches: | |
- main | |
# permissions: | |
# contents: read | |
jobs: | |
build: | |
name: Run Script | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
env: | |
LEATHERMAN_VERSION: 1.12.11 | |
CPP_PCP_CLIENT_VERSION: 1.7.7 | |
CPPHOCON_VERSION: 0.3.0 | |
GITHUB_TOKEN: ${{ github.token }} | |
shell: pwsh | |
run: | | |
$DotNetInstallationInfo = Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | |
$InstalledDotNetVersions = $DotNetInstallationInfo | Get-ItemProperty -Name 'Version' -ErrorAction SilentlyContinue | |
$InstalledVersionNumbers = $InstalledDotNetVersions | ForEach-Object {$_.Version -as [System.Version]} | |
$Installed3Point5Versions = $InstalledVersionNumbers | Where-Object {$_.Major -eq 3 -and $_.Minor -eq 5} | |
$DotNet3Point5IsInstalled = $Installed3Point5Versions.Count -ge 1 | |
Write-Output $DotNet3Point5IsInstalled | |
# The mingw 5.2 package requires chocolatey 1.4, so delete 2.x | |
Remove-Item -Path C:\ProgramData\chocolatey\ -Recurse -Force | |
# Reinstall choco 1.4 in the same place, so PATH doesn't need changing | |
$env:chocolateyVersion = '1.4.0' | |
[System.Net.ServicePointManager]::SecurityProtocol = 3072 | |
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
# This is only needed because we deleted choco 2.x | |
choco install -y 7zip.install | |
# And our build dependencies | |
choco install -y mingw-w64 -Version 5.2.0 -source https://www.myget.org/F/puppetlabs | |
choco install -y cmake -Version 3.2.2 -source https://www.myget.org/F/puppetlabs | |
choco install -y gettext -Version 0.19.6 -source https://www.myget.org/F/puppetlabs | |
choco install -y pl-toolchain-x64 -Version 2015.12.01.1 -source https://www.myget.org/F/puppetlabs | |
choco install -y pl-boost-x64 -Version 1.58.0.2 -source https://www.myget.org/F/puppetlabs | |
choco install -y pl-openssl-x64 -Version 1.0.24.1 -source https://www.myget.org/F/puppetlabs | |
choco install -y pl-curl-x64 -Version 7.46.0.1 -source https://www.myget.org/F/puppetlabs | |
choco install -y pl-zlib-x64 -Version 1.2.8.1 -source https://www.myget.org/F/puppetlabs | |
choco install -y pester -Version 4.10.1 | |
# And our library dependencies | |
gh release download -R puppetlabs/leatherman $env:LEATHERMAN_VERSION --pattern "leatherman.7z" | |
7z.exe x leatherman.7z -oC:\tools | FIND /V "ing " | |
gh release download -R puppetlabs/cpp-pcp-client $env:CPP_PCP_CLIENT_VERSION --pattern "cpp-pcp-client.7z" | |
7z.exe x cpp-pcp-client.7z -oC:\tools | FIND /V "ing " | |
gh release download -R puppetlabs/cpp-hocon $env:CPPHOCON_VERSION --pattern "cpp-hocon.7z" | |
7z.exe x cpp-hocon.7z -oC:\tools | FIND /V "ing " | |
- name: Build | |
shell: pwsh | |
run: | | |
# Intentionally excluding some preinstalled components that conflict with our | |
# ancient build tooling and dependencies: Git (due to sh.exe), mingw64, cmake, OpenSSL | |
# | |
# Include Ruby and Powershell for unit tests | |
$oldpath = $env:PATH.Split(';') | |
$newpath = $oldpath | Where-Object { $_ -NotLike 'C:\Program Files\Git\*' -and $_ -NotLike 'C:\mingw64\*' -and $_ -NotLike 'C:\Program Files\CMake\*' -and $_ -NotLike 'C:\Program Files\OpenSSL\*' } | |
$diffpath = Compare-Object -ReferenceObject $oldpath -DifferenceObject $newpath -PassThru | |
Write-Output "Deleted: " $diffpath | |
$env:PATH = $newpath -Join ';' | |
# Prepend our tools | |
$env:PATH = "C:\tools\pl-build-tools\bin;C:\tools\mingw64\bin;$env:PATH" | |
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="C:\tools\pl-build-tools\pl-build-toolchain.cmake" -DCMAKE_PREFIX_PATH="C:\tools\leatherman;C:\tools\cpp-pcp-client;C:\tools\cpp-hocon" -DCMAKE_INSTALL_PREFIX=C:\tools -DBOOST_STATIC=ON . | |
mingw32-make install | |
- name: Test | |
shell: pwsh | |
run: | | |
cp C:\Tools\pl-build-tools\bin\libeay32.dll .\bin | |
cp C:\Tools\pl-build-tools\bin\ssleay32.dll .\bin | |
ctest -V 2>&1 | %{ if ($_ -is [System.Management.Automation.ErrorRecord]) { $_ | c++filt } else { $_ } } | |
type ./acceptance/files/complex-args.json | ./exe/PowershellShim.ps1 ./acceptance/files/complex-task.ps1 | |
Invoke-Pester -EnableExit | |
#Remove-Item -Path "C:\Program Files\OpenSSL" -Recurse -Force | |
#Write-Host $env:PATH | |
#$env:ORIGPATH = $env:PATH | |
#$env:PATH = "C:\tools\pl-build-tools\bin;C:\tools\mingw64\bin;C:\Program Files\PowerShell\7;C:\hostedtoolcache\windows\stack\2.13.1\x64;C:\Program Files\dotnet;C:\hostedtoolcache\windows\Ruby\2.5.9\x64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Chocolatey\bin;C:\Program Files\CMake\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps" | |
#shell: pwsh |