Release v0.12.0 #128
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: Build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
# C:\ drive in gh action is much slower than D:\, move everything we can to D:\ | |
DOTNET_INSTALL_DIR: D:\dotnet | |
# versions of dependencies needed for building and bootstrapping Pog | |
# these should be updated periodically with the following command: | |
# ``` | |
# "VERSION_DOTNET: `"$(dotnet --version)`"" | |
# "VERSION_PESTER: `"$((Find-Module Pester).Version)`"" | |
# "VERSION_WIX_DARK: `"$((Find-Pog dark@ScoopInstaller).Version)`"" | |
# Find-Pog ILRepack, UPX, 7zip | % {"VERSION_$($_.PackageName.ToUpperInvariant()): `"$($_.Version)`""} | |
# ``` | |
VERSION_DOTNET: "9.0.101" | |
VERSION_PESTER: "5.7.1" | |
VERSION_WIX_DARK: "3.14" | |
VERSION_ILREPACK: "2.0.29" | |
VERSION_UPX: "4.2.3" | |
VERSION_7ZIP: "24.08" | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Configure git to preserve line endings | |
run: git config --global core.autocrlf false | |
- uses: actions/checkout@v4 | |
# needed to build Pog.dll | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{env.VERSION_DOTNET}} | |
cache: true | |
cache-dependency-path: app/Pog/lib_compiled/*/packages.lock.json | |
# used for PowerShell unit tests | |
- name: Install Pester | |
working-directory: .. | |
shell: pwsh | |
run: | | |
# this is significantly faster than `Install-Module Pester -Force` | |
iwr "https://www.powershellgallery.com/api/v2/package/Pester/$($env:VERSION_PESTER)" -OutFile D:\pester.nupkg | |
$ModuleDir = "$(Split-Path $PROFILE)\Modules" | |
Expand-Archive D:\pester.nupkg "$ModuleDir\Pester" | |
# needed to unpack vcredist packages | |
- name: Install WiX dark.exe | |
shell: pwsh | |
run: | | |
iwr "https://raw.githubusercontent.com/ScoopInstaller/Binary/master/dark/dark-$($env:VERSION_WIX_DARK).zip" -OutFile D:\dark.zip | |
Expand-Archive D:\dark.zip D:\dark | |
Add-Content $env:GITHUB_PATH D:\dark | |
# needed to build Pog.dll | |
- name: Install ILRepack | |
shell: pwsh | |
run: | | |
iwr "https://www.nuget.org/api/v2/package/ILRepack/${env:VERSION_ILREPACK}" -OutFile D:\ilrepack.nupkg | |
Expand-Archive D:\ilrepack.nupkg D:\ilrepack | |
# add to PATH for following steps | |
Add-Content $env:GITHUB_PATH D:\ilrepack\tools | |
# needed to build PogShimTemplate.exe | |
- name: Install UPX | |
shell: pwsh | |
run: | | |
iwr "https://github.com/upx/upx/releases/download/v${env:VERSION_UPX}/upx-${env:VERSION_UPX}-win64.zip" -OutFile D:\upx.zip | |
Expand-Archive D:\upx.zip D:\upx_tmp | |
mv D:\upx_tmp\* D:\upx | |
rm D:\upx_tmp | |
# add to PATH for following steps | |
Add-Content $env:GITHUB_PATH D:\upx | |
# needed to install any Pog package (including an up-to-date 7zip) | |
- name: Install bootstrap 7zip | |
working-directory: .. | |
shell: pwsh | |
run: | | |
iwr "https://www.7-zip.org/a/7z$($env:VERSION_7ZIP.Replace('.', ''))-x64.exe" -OutFile D:\7zip.exe | |
Start-Process -Wait D:\7zip.exe -ArgumentList /S, /D=$PWD\7zip\app | |
# just a stub manifest, will be replaced later | |
Set-Content $PWD\7zip\pog.psd1 '@{Private = $true; Enable = {Export-Command "7z" "./app/7z.exe" -VcRedist}}' | |
- name: Verify build dependencies | |
shell: pwsh | |
run: | | |
[pscustomobject]@{Name = "dotnet.exe"; Version = dotnet.exe --version; Source = (gcm dotnet.exe).Source} | |
gmo Pester -ListAvailable | select -First 1 | |
gcm dark.exe | |
gcm ilrepack.exe | |
gcm upx.exe | |
gcm ..\7zip\app\7z.exe | |
- name: Build Pog.dll | |
working-directory: app/Pog/lib_compiled | |
run: | | |
dotnet sln remove RandomTests RandomBenchmarks | |
dotnet restore | |
dotnet publish --no-restore Pog | |
- name: Build Pog.Shim | |
working-directory: app/Pog/lib_compiled | |
run: | | |
cmake -B ./Pog.Shim/cmake-build-release -S ./Pog.Shim -DCMAKE_BUILD_TYPE=Release | |
cmake --build ./Pog.Shim/cmake-build-release --config Release | |
gi ./PogShimTemplate.exe | |
- name: Download VC Redistributable | |
shell: pwsh | |
run: | | |
./app/Pog/_scripts/vcredist-download.ps1 -OutDir ./app/Pog/lib_compiled/vc_redist @( | |
# latest vcredist 140 | |
"https://aka.ms/vs/17/release/vc_redist.x64.exe" | |
# fixed vcredist 120 | |
"https://aka.ms/highdpimfc2013x64enu" | |
) | |
- name: Setup Pog | |
shell: pwsh | |
run: | | |
.\setup.ps1 | |
# add to PATH for following steps | |
Add-Content $env:GITHUB_PATH (Resolve-Path .\data\package_bin) | |
pog 7zip -Force | |
- name: Pog.Tests | |
working-directory: app/Pog/lib_compiled | |
run: dotnet test --no-restore Pog.Tests | |
- name: Pester tests (PowerShell Core) | |
working-directory: app/Pog | |
shell: pwsh | |
run: Invoke-Pester | |
- name: Pester tests (PowerShell 5) | |
working-directory: app/Pog | |
shell: powershell | |
run: Invoke-Pester | |
# install a few Pog packages to check that Pog works | |
- name: Test Pog packages (PowerShell Core) | |
shell: pwsh | |
run: | | |
Write-Host "PowerShell v$($PSVersionTable.PSVersion)" | |
$InformationPreference = "Continue" | |
Import-Module ./app/Pog -Verbose | |
Write-Host "Available packages: $(@(Find-Pog -AllVersions).Count)" | |
pog fzf, zstd, Jujutsu | |
Get-Pog | |
Write-Host "" | |
Write-Host "fzf: $(fzf --version)" | |
Write-Host "zstd: $(zstd --version)" | |
Write-Host "Jujutsu: $(jj --version)" | |
Write-Host "" | |
Uninstall-Pog fzf, zstd, Jujutsu | |
Clear-PogDownloadCache -Force | |
# the same test in PowerShell 5, to test compatibility | |
- name: Test Pog packages (PowerShell 5) | |
shell: powershell | |
run: | | |
Write-Host "PowerShell v$($PSVersionTable.PSVersion)" | |
$InformationPreference = "Continue" | |
Import-Module ./app/Pog -Verbose | |
Write-Host "Available packages: $(@(Find-Pog -AllVersions).Count)" | |
pog fzf, zstd, Jujutsu | |
Get-Pog | |
Write-Host "" | |
Write-Host "fzf: $(fzf --version)" | |
Write-Host "zstd: $(zstd --version)" | |
Write-Host "Jujutsu: $(jj --version)" | |
Write-Host "" | |
Uninstall-Pog fzf, zstd, Jujutsu | |
Clear-PogDownloadCache -Force | |
- name: Generate release archive | |
shell: pwsh | |
run: | | |
& ./app/Pog/_scripts/release/build-release.ps1 -ReleasePath D:/PogRelease.zip | |
# unpack so that the generated artifact (which is always zipped) is not a nested .zip | |
Expand-Archive D:\PogRelease.zip D:\PogRelease | |
- name: Publish release archive as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Pog | |
path: D:/PogRelease |