simh-testsetgenerator/.github/workflows/cmake-builds.yml
B. Scott Michel 487f243c28 CMake: Bump project version to 4.1.0
- Bump SIMH_VERSION_MINOR in CMakeLists.txt. This propagates down
  through the rest of the CMake infrastructure.

- README-CMake.md, cmake/{GitHub-release.md,cmake-builder.sh}: Update
  documentation. (Prettiness.)

- vcpkg.json: Update simh version-string. (Consistency.)

NOTE: Github CI/CD: There has to be an automated way to update version
numbers; researching.
2023-07-31 13:04:33 -04:00

309 lines
13 KiB
YAML

name: CMake build workflows
on:
workflow_call:
jobs:
cmake-unix:
name: Ubuntu
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sh -ex .travis/deps.sh linux
sudo apt install -ym ninja-build
- name: cmake-builder.sh
run: |
cmake/cmake-builder.sh --config Release --flavor ninja --lto --notest --parallel --verbose --cpack_suffix x86_64-${{matrix.os}}
- name: SIMH simulator suite test
run: |
cmake/cmake-builder.sh --config Release --flavor ninja --testonly
## Install isn't strictly necessary, but it's a good way to see what dependencies
## (IMPORTED_RUNTIME_ARTIFACTS) get installed.
- name: Install
run: |
cmake/cmake-builder.sh --config Release --flavor ninja --installonly
- name: SIMH packaging
run: |
cd cmake/build-ninja
cpack -G DEB -C Release
- name: Upload DEB
uses: actions/upload-artifact@v3
with:
name: simh-4.1.0-x86_64-${{matrix.os}}.deb
path: cmake/build-ninja/simh-4.1.0-x86_64-${{matrix.os}}.deb
cmake-macOS:
name: macOS
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12, macos-11]
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sh -ex .travis/deps.sh osx
- name: cmake-builder.sh
run: |
cmake/cmake-builder.sh --config Release --flavor xcode --lto --notest --cpack_suffix x86_64.${{matrix.os}}
- name: SIMH simulator suite test
run: |
cmake/cmake-builder.sh --config Release --flavor xcode --testonly
## Install isn't strictly necessary, but it's a good way to see what dependencies
## (IMPORTED_RUNTIME_ARTIFACTS) get installed.
- name: Install
run: |
cmake/cmake-builder.sh --config Release --flavor xcode --installonly
- name: SIMH packaging
run: |
cd cmake/build-xcode
cpack -G "ZIP;TGZ" -C Release
cpack -G DragNDrop -C Release
- name: Upload ZIP
uses: actions/upload-artifact@v3
with:
name: simh-4.1.0-x86_64.${{matrix.os}}.zip
path: cmake/build-xcode/simh-4.1.0-x86_64.${{matrix.os}}.zip
- name: Upload DMG
uses: actions/upload-artifact@v3
with:
name: simh-4.1.0-x86_64.${{matrix.os}}.dmg
path: cmake/build-xcode/simh-4.1.0-x86_64.${{matrix.os}}.dmg
## This looks like it's doing the right thing on the Github CI/CD pipeline because
## the output contains references to x86_64 and arm64 targets for Mac OS 12.
##
## However, need to figure out how to concurrently install BOTH arm64 and intel
## Homebrews AND how to tell SDL2 which set of header files it should use for
## platform-specific assembly (/usr/local vs. /opt/local.)
##
# cmake-macOS-universal:
# name: macOS universal
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [macos-12]
# steps:
# - uses: actions/checkout@v3
# - name: Install dependencies
# run: |
# sh -ex .travis/deps.sh osx
# - name: cmake-builder.sh
# run: |
# cmake/cmake-builder.sh --config Release --flavor xcode-universal --lto --notest
# - name: SIMH simulator suite test
# run: |
# cmake/cmake-builder.sh --config Release --flavor xcode-universal --testonly
cmake-vs2022xp:
name: VS 2022 XP-compatible LEGACY
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install v141_xp (XP toolkit) and build SIMH
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$WarningPreference = "Continue"
$DebugPreference = "Continue"
# Fix PATH so that "C:\Strawberry" (Strawberry Perl) doesn't mess with the build
# CMake WILL find incompatible libraries within Strawberry.
$fixPATH = (${env:PATH}.Split(';') | `
Where-Object { $_ -notlike "*\Strawberry\*" -and $_ -notlike "*/Strawberry/*" }) -join ';'
$env:Path = $fixPATH
#+
# Update the existing Github Visual Studio installation in-place. `vswhere` may find multiple
# VS installations, so iterate through them all.
#
# This is Grey Magic. `vs_installer` exits almost immediately if you run it from the command
# line. However, `vs_installer`'s subprocesses are well known and we look for them and wait
# for them to terminate.
#
# GH Actions does something strange with stdout and stderr, so you won't get any
# indication of failure or output that shows you that something is happening.
#
# The waiting code was adapted from the Chocolatey VS installer scripts.
#-
$vswhere = "${env:ProgramFiles} (x86)\Microsoft Visual Studio\Installer\vswhere"
$vsinstaller = "${env:ProgramFiles} (x86)\Microsoft Visual Studio\Installer\vs_installer.exe"
$vsInstallOut = "$env:TEMP\vsinstall-out.txt"
$vsInstallErr = "$env:TEMP\vsinstall-err.txt"
& ${vswhere} -property installationPath | `
Foreach-Object -process {
## --quiet: Don't open/show UI
## --force: Terminate any VS instances forcibly
## --norestart: Delay reboot after install, if needed
## --installWhileDownloading: Self-explanitory.
$Params = @(
"modify",
"--installPath", "$_",
"--add", "Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"--add", "Microsoft.VisualStudio.Component.WinXP",
"--quiet", "--force", "--norestart", "--installWhileDownloading"
)
& $vsInstaller $Params 2> $vsInstallErr > $vsInstallOut
$vsinstallerProcesses = @('vs_installer', 'vs_installershell', 'vs_installerservice')
$vsInstallerStartup = $true
$vsInstallerStartCount = 10
do
{
Write-Debug ('Looking for running VS installer processes')
$vsInstallerRemaining = Get-Process -Name $vsinstallerProcesses -ErrorAction SilentlyContinue | Where-Object { $null -ne $_ -and -not $_.HasExited }
$vsInstallerProcessCount = ($vsInstallerRemaining | Measure-Object).Count
if ($vsInstallerProcessCount -gt 0)
{
## Installer processes are present, so obviously not starting up.
$vsInstallerStartup = $false
try
{
Write-Debug "Found $vsInstallerProcessCount running Visual Studio installer processes which are known to exit asynchronously:"
$vsInstallerRemaining | Sort-Object -Property Name, Id | ForEach-Object { '[{0}] {1}' -f $_.Id, $_.Name } | Write-Debug
Write-Debug ('Giving the processes some time to exit')
$vsInstallerRemaining | Wait-Process -Timeout 45 -ErrorAction SilentlyContinue
}
finally
{
$vsInstallerRemaining | ForEach-Object { $_.Dispose() }
$vsInstallerRemaining = $null
}
} else {
if ($vsInstallerStartup) {
if ($vsInstallerStartCount -gt 0) {
Write-Debug "No VS installer processes detected; sleeping with $vsInstallerStartCount tries remaining."
Start-Sleep -Seconds 10.0
$vsInstallerStartCount -= 1
} else {
$vsInstallerStartup = $false
Write-Debug "VS installer never started? Exiting."
Exit 99
}
}
}
}
while (($vsInstallerStartup -and $vsInstallerStartCount -gt 0) -or $vsInstallerProcessCount -gt 0)
}
if ((Test-Path $vsInstallOut -PathType Leaf) -and (Get-Item $vsInstallOut).length -gt 0kb)
{
Write-Output "-- vsinstaller output:"
Get-Content $vsInstallOut
}
else
{
Write-Debug "-- No vsinstaller output."
}
if ((Test-Path $vsInstallErr -PathType Leaf) -and (Get-Item $vsInstallErr).length -gt 0kb)
{
Write-Output "-- vsinstaller error output:"
Get-Content $vsInstallErr
}
else
{
Write-Debug "-- No vsinstaller error/diag output."
}
#+
# The GH Windows runner image documentation says that the VSSetup module is installed, from
# whence Get-VSSetupInstance and Select-VSSetupInstance are imported. This step is pure
# paranoia, ensuring that we really, truly and honestly have WinXP support.
#-
Write-Debug "Get-VSSetupInstance/Select-VSSetupInstance"
Get-VSSetupInstance -All | Select-VSSetupInstance -Require 'Microsoft.VisualStudio.Component.WinXP' -Latest
## Don't use LTO for XP. XP compatibility comes from VS2017 -- MS is
## at VS2022. There are likely legacy bugs that have been fixed.
./cmake/cmake-builder.ps1 -flavor vs2022-xp -config Release -clean -verbose -notest -cpack_suffix win32-xp
- name: SIMH simulator suite test
shell: pwsh
run: |
./cmake/cmake-builder.ps1 -flavor vs2022-xp -config Release -testOnly
## Install isn't strictly necessary, but it's a good way to see what dependencies
## (IMPORTED_RUNTIME_ARTIFACTS) get installed.
- name: Install
shell: pwsh
run: |
cmake/cmake-builder.ps1 -config Release -flavor vs2022-xp -installOnly
- name: SIMH packaging
shell: pwsh
run: |
cd cmake\build-vs2022-xp
cpack -G "ZIP;WIX" -C Release
- name: Upload ZIP
uses: actions/upload-artifact@v3
with:
name: simh-4.1.0-win32-vs2022xp.zip
path: cmake/build-vs2022-xp/simh-4.1.0-win32-xp.zip
- name: Upload MSI
uses: actions/upload-artifact@v3
with:
name: simh-4.1.0-win32-vs2022xp.zip
path: cmake/build-vs2022-xp/simh-4.1.0-win32-xp.msi
cmake-vs2022:
name: VS 2022 Win10 native VCPKG
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: vs2022 build
shell: pwsh
run: |
$ErrorActionPreference="Stop"
$WarningPreference="Continue"
# Fix PATH so that "C:\Strawberry" (Strawberry Perl) doesn't mess with the build
# CMake WILL find incompatible libraries within Strawberry.
$fixPATH = (${env:PATH}.Split(';') | `
Where-Object { $_ -notlike "*\Strawberry\*" -and $_ -notlike "*/Strawberry/*" }) -join ';'
$env:PATH = $fixPATH
# Make this a vcpkg build:
$env:VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT
Push-Location $env:VCPKG_ROOT
git pull
Pop-Location
./cmake/cmake-builder.ps1 -flavor vs2022 -config Release -clean -lto -verbose -notest -cpack_suffix win32-native
- name: SIMH simulator suite test
shell: pwsh
run: |
./cmake/cmake-builder.ps1 -flavor vs2022 -config Release -testOnly
## Install isn't strictly necessary, but it's a good way to see what dependencies
## (IMPORTED_RUNTIME_ARTIFACTS) get installed.
- name: Install
shell: pwsh
run: |
cmake/cmake-builder.ps1 -config Release -flavor vs2022 -installOnly
- name: SIMH packaging
shell: pwsh
run: |
cd cmake\build-vs2022
cpack -G "NSIS;WIX;ZIP" -C Release
- name: Upload ZIP
uses: actions/upload-artifact@v3
with:
name: simh-4.1.0-win32-vs2022.zip
path: cmake/build-vs2022/simh-4.1.0-win32-native.zip
- name: Upload EXE installer
uses: actions/upload-artifact@v3
with:
name: simh-4.1.0-win32-vs2022.exe
path: cmake/build-vs2022/simh-4.1.0-win32-native.exe
- name: Upload MSI installer
uses: actions/upload-artifact@v3
with:
name: simh-4.1.0-win32-vs2022.msi
path: cmake/build-vs2022/simh-4.1.0-win32-native.msi