Skip to content

chore: better debug reporting in VM::TIMER #119

chore: better debug reporting in VM::TIMER

chore: better debug reporting in VM::TIMER #119

name: vmaware build infrastructure
permissions:
contents: read
on:
push:
branches: ["main"]
paths:
- 'src/**/*.cpp'
- 'src/**/*.hpp'
- '.github/workflows/build_infrastructure.yml'
- 'CMakeLists.txt'
- 'auxiliary/test_cli.sh'
- 'auxiliary/test_cli.ps1'
- 'auxiliary/memoize_test.cpp'
pull_request:
branches: ["main"]
paths:
- 'src/**/*.cpp'
- 'src/**/*.hpp'
- '.github/workflows/build_infrastructure.yml'
- 'CMakeLists.txt'
- 'auxiliary/test_cli.sh'
- 'auxiliary/test_cli.ps1'
- 'auxiliary/memoize_test.cpp'
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
linux-compilation:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- arch: amd64
compiler: g++
- arch: arm64
compiler: aarch64-linux-gnu-g++
package: g++-aarch64-linux-gnu
processor: aarch64
- arch: armhf
compiler: arm-linux-gnueabihf-g++
package: g++-arm-linux-gnueabihf
processor: arm
- arch: armel
compiler: arm-linux-gnueabi-g++
package: g++-arm-linux-gnueabi
processor: arm
- arch: i386
compiler: i686-linux-gnu-g++
package: g++-i686-linux-gnu
processor: i686
- arch: mips64el
compiler: mips64el-linux-gnuabi64-g++
package: g++-mips64el-linux-gnuabi64
processor: mips64
- arch: ppc64el
compiler: powerpc64le-linux-gnu-g++
package: g++-powerpc64le-linux-gnu
processor: powerpc64le
- arch: riscv64
compiler: riscv64-linux-gnu-g++
package: g++-riscv64-linux-gnu
processor: riscv64
- arch: s390x
compiler: s390x-linux-gnu-g++
package: g++-s390x-linux-gnu
processor: s390x
steps:
- uses: actions/checkout@v4
- name: Install tools (${{ matrix.arch }})
run: |
sudo apt-get update -q
sudo apt-get install -y --no-install-recommends cmake ${{ matrix.package }}
- name: Build (${{ matrix.arch }})
run: |
CROSS_ARGS=""
if [ -n "${{ matrix.processor }}" ]; then
CROSS_ARGS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.processor }}"
fi
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
$CROSS_ARGS
cmake --build build --config Release
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: vmaware-linux-${{ matrix.arch }}
path: build/vmaware
if-no-files-found: error
retention-days: 30
linux-cpp-standard:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
std: [26, 23, 20, 17, 14, 11]
steps:
- uses: actions/checkout@v4
- name: Install g++-14
run: |
sudo apt-get update -q
sudo apt-get install -y --no-install-recommends g++-14
- name: Configure (C++${{ matrix.std }})
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=${{ matrix.std }} \
-DCMAKE_CXX_COMPILER=g++-14
- name: Build (C++${{ matrix.std }})
run: cmake --build build --config Release
linux-compiler-compat:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
include:
- compiler: g++-12
package: g++-12
- compiler: g++-13
package: g++-13
- compiler: g++-14
package: g++-14
- compiler: clang++-16
package: clang-16
- compiler: clang++-17
package: clang-17
- compiler: clang++-18
package: clang-18
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.compiler }}
run: |
sudo apt-get update -q
sudo apt-get install -y --no-install-recommends ${{ matrix.package }}
- name: Configure (${{ matrix.compiler }})
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
- name: Build (${{ matrix.compiler }})
run: cmake --build build --config Release
macos-compilation:
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
include:
- arch: aarch64
cmake_arch: arm64
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Dev_Release \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }} \
-S ${{ github.workspace }}
- name: Build
run: cmake --build build --config Release
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: vmaware-macos-${{ matrix.arch }}
path: build/vmaware
if-no-files-found: error
retention-days: 30
macos-cpp-standard:
runs-on: macos-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
std: [26, 23, 20, 17, 14, 11]
steps:
- uses: actions/checkout@v4
- name: Configure (C++${{ matrix.std }})
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{ matrix.std }}
- name: Build (C++${{ matrix.std }})
run: cmake --build build --config Release
windows-x86-compilation:
runs-on: windows-2022
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
include:
- config: 64-debug
arch: x64
debug_output: ON
artifact: vmaware64_debug.exe
- config: 32-debug
arch: Win32
debug_output: ON
artifact: vmaware32_debug.exe
- config: 32-release
arch: Win32
debug_output: OFF
artifact: vmaware32_release.exe
- config: 64-release
arch: x64
debug_output: OFF
artifact: vmaware64_release.exe
steps:
- uses: actions/checkout@v4
- name: Disable Windows Defender real-time monitoring
shell: pwsh
run: Set-MpPreference -DisableRealtimeMonitoring $true
- name: Configure (${{ matrix.config }})
run: cmake -B build -G "Visual Studio 17 2022" -A ${{ matrix.arch }} -DDEBUG_OUTPUT=${{ matrix.debug_output }}
- name: Build (${{ matrix.config }})
run: cmake --build build --config Release
- name: Rename binary with commit info
shell: pwsh
run: |
$shortSha = "${{ github.sha }}".Substring(0,12)
$run = "${{ github.run_number }}"
Add-Content $env:GITHUB_ENV "SHORT_SHA=$shortSha"
Rename-Item build\Release\vmaware.exe "vmaware_${run}_${shortSha}.exe"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: build\Release\vmaware_${{ github.run_number }}_${{ env.SHORT_SHA }}.exe
windows-arm-compilation:
runs-on: windows-11-arm
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
include:
- config: arm64-debug
platform: ARM64
build_config: Debug
debug_output: ON
artifact: vmaware-arm64_debug.exe
- config: arm64-release
platform: ARM64
build_config: Release
debug_output: OFF
artifact: vmaware-arm64_release.exe
- config: arm32-debug
platform: ARM,version=10.0.22621.0
build_config: Debug
debug_output: ON
artifact: vmaware-arm32_debug.exe
- config: arm32-release
platform: ARM,version=10.0.22621.0
build_config: Release
debug_output: OFF
artifact: vmaware-arm32_release.exe
steps:
- uses: actions/checkout@v4
- name: Configure (${{ matrix.config }})
run: >
cmake -B build
-G "Visual Studio 17 2022"
-A "${{ matrix.platform }}"
-DDEBUG_OUTPUT=${{ matrix.debug_output }}
- name: Build (${{ matrix.config }})
run: cmake --build build --config ${{ matrix.build_config }}
- name: Rename binary with commit info
shell: pwsh
run: |
$shortSha = "${{ github.sha }}".Substring(0,12)
$run = "${{ github.run_number }}"
Add-Content $env:GITHUB_ENV "SHORT_SHA=$shortSha"
$source = "build\${{ matrix.build_config }}\vmaware.exe"
$target = "vmaware_${run}_${shortSha}.exe"
Rename-Item $source $target
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: vmaware_${{ github.run_number }}_${{ env.SHORT_SHA }}.exe
windows-cpp-standard:
runs-on: windows-2022
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
std: [23, 20, 17, 14, 11]
steps:
- uses: actions/checkout@v4
- name: Configure (C++${{ matrix.std }})
run: cmake -B build -DCMAKE_CXX_STANDARD=${{ matrix.std }}
- name: Build (C++${{ matrix.std }})
run: cmake --build build --config Release
windows-unicode:
runs-on: windows-2022
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Configure (Unicode x64)
run: cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_CXX_FLAGS="/D \"_UNICODE\""
- name: Build (Unicode Release)
run: cmake --build build --config Release
windows-crt-leaks:
runs-on: windows-2022
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Configure (CRT leak check)
run: cmake -B build -G "Visual Studio 17 2022" -A x64 -DDEBUG_OUTPUT=ON
- name: Build (CRT Debug)
run: cmake --build build --config Debug
- name: Run CLI test suite (CRT)
shell: pwsh
run: |
$bin = "build\Debug\vmaware.exe"
pwsh auxiliary/test_cli.ps1 -BIN $bin -TIMEOUT_SECS 30
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
windows-asan:
runs-on: windows-2022
timeout-minutes: 30
env:
ASAN_OPTIONS: windows_fast_fail_on_error=true:alloc_dealloc_mismatch=1
steps:
- uses: actions/checkout@v4
- name: Disable Windows Defender real-time monitoring
shell: pwsh
run: Set-MpPreference -DisableRealtimeMonitoring $true
- name: Configure (ASAN x64)
run: cmake -B build -G "Visual Studio 17 2022" -A x64 -DENABLE_ASAN=ON -DDEBUG_OUTPUT=ON
- name: Build (ASAN Debug)
run: cmake --build build --config Debug
- name: Add ASAN runtime DLLs to PATH
shell: pwsh
run: |
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
-latest -products * `
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
-property installationPath
$msvcVersion = Get-ChildItem "$vsPath\VC\Tools\MSVC" |
Sort-Object Name -Descending |
Select-Object -First 1 -ExpandProperty Name
$asanDir = "$vsPath\VC\Tools\MSVC\$msvcVersion\bin\Hostx64\x64"
Add-Content $env:GITHUB_PATH $asanDir
- name: Full CLI output (ASAN)
shell: pwsh
run: |
$bin = "build\Debug\vmaware.exe"
& $bin
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Run CLI test suite (ASAN)
shell: pwsh
run: |
$bin = "build\Debug\vmaware.exe"
pwsh auxiliary/test_cli.ps1 -BIN $bin -TIMEOUT_SECS 30
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
linux:
needs: [linux-compilation, linux-cpp-standard, linux-compiler-compat]
runs-on: ubuntu-latest
steps:
- run: echo "Linux builds completed"
macos:
needs: [macos-compilation, macos-cpp-standard]
runs-on: ubuntu-latest
steps:
- run: echo "MacOS builds completed"
windows:
needs: [windows-x86-compilation, windows-arm-compilation, windows-cpp-standard, windows-unicode, windows-asan, windows-crt-leaks]
runs-on: ubuntu-latest
steps:
- run: echo "Windows builds completed"
cli-test-linux:
needs: [linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download amd64 binary
uses: actions/download-artifact@v4
with:
name: vmaware-linux-amd64
path: build
- name: Full CLI output
run: |
chmod +x build/vmaware
build/vmaware || true
- name: Run CLI test suite
run: |
chmod +x build/vmaware
bash auxiliary/test_cli.sh build/vmaware
cli-test-macos:
needs: [macos]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Download macOS binary
uses: actions/download-artifact@v4
with:
name: vmaware-macos-aarch64
path: build
- name: Full CLI output
run: |
chmod +x build/vmaware
build/vmaware || true
- name: Run CLI test suite
run: |
chmod +x build/vmaware
bash auxiliary/test_cli.sh build/vmaware
cli-test-windows:
needs: [windows]
runs-on: windows-2022
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Download vmaware64_release
uses: actions/download-artifact@v4
with:
name: vmaware64_release.exe
path: build\vmaware64_release
- name: Download vmaware64_debug
uses: actions/download-artifact@v4
with:
name: vmaware64_debug.exe
path: build\vmaware64_debug
- name: Download vmaware32_release
uses: actions/download-artifact@v4
with:
name: vmaware32_release.exe
path: build\vmaware32_release
- name: Download vmaware32_debug
uses: actions/download-artifact@v4
with:
name: vmaware32_debug.exe
path: build\vmaware32_debug
- name: Full CLI output (vmaware64_release)
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware64_release -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
Write-Host "=== vmaware64_release ==="
& $bin; $true | Out-Null
- name: Run CLI test suite (vmaware64_release)
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware64_release -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
pwsh auxiliary/test_cli.ps1 -BIN $bin -TIMEOUT_SECS 10
- name: Full CLI output (vmaware64_debug)
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware64_debug -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
Write-Host "=== vmaware64_debug ==="
& $bin; $true | Out-Null
- name: Run CLI test suite (vmaware64_debug)
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware64_debug -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
pwsh auxiliary/test_cli.ps1 -BIN $bin -TIMEOUT_SECS 10
- name: Full CLI output (vmaware32_release)
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware32_release -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
Write-Host "=== vmaware32_release ==="
& $bin; $true | Out-Null
- name: Run CLI test suite (vmaware32_release)
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware32_release -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
pwsh auxiliary/test_cli.ps1 -BIN $bin -TIMEOUT_SECS 10
- name: Full CLI output (vmaware32_debug)
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware32_debug -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
Write-Host "=== vmaware32_debug ==="
& $bin; $true | Out-Null
- name: Run CLI test suite (vmaware32_debug)
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware32_debug -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
pwsh auxiliary/test_cli.ps1 -BIN $bin -TIMEOUT_SECS 10
memoize-test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install g++
run: |
sudo apt-get update -q
sudo apt-get install -y --no-install-recommends g++
- name: Compile memoize test
run: |
g++ -std=c++20 -O2 -Wall -Wextra -Wconversion -Wdouble-promotion \
-Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion \
-D__VMAWARE_RELEASE__ \
-o memoize_test auxiliary/memoize_test.cpp
- name: Run memoize test
run: ./memoize_test
vm-output-test-linux:
needs: [linux]
runs-on: ubuntu-latest
steps:
- name: Download amd64 binary
uses: actions/download-artifact@v4
with:
name: vmaware-linux-amd64
path: build
- name: Make executable
run: chmod +x build/vmaware
- name: Check --detect = 1
run: |
result=$(build/vmaware --detect)
if [ "$result" != "1" ]; then
echo "FAIL: --detect expected 1, got '$result'"
exit 1
fi
echo "PASS: --detect = $result"
- name: Check --percent = 100
run: |
result=$(build/vmaware --percent)
if [ "$result" != "100" ]; then
echo "FAIL: --percent expected 100, got '$result'"
exit 1
fi
echo "PASS: --percent = $result"
- name: Check --brand = "Microsoft Azure Hyper-V"
run: |
result=$(build/vmaware --brand)
expected="Microsoft Azure Hyper-V"
if [ "$result" != "$expected" ]; then
echo "FAIL: --brand expected '$expected', got '$result'"
exit 1
fi
echo "PASS: --brand = $result"
vm-output-test-macos:
needs: [macos]
runs-on: macos-latest
steps:
- name: Download macOS binary
uses: actions/download-artifact@v4
with:
name: vmaware-macos-aarch64
path: build
- name: Make executable
run: chmod +x build/vmaware
- name: Check --detect = 1
run: |
result=$(build/vmaware --detect)
if [ "$result" != "1" ]; then
echo "FAIL: --detect expected 1, got '$result'"
exit 1
fi
echo "PASS: --detect = $result"
- name: Check --percent = 100
run: |
result=$(build/vmaware --percent)
if [ "$result" != "100" ]; then
echo "FAIL: --percent expected 100, got '$result'"
exit 1
fi
echo "PASS: --percent = $result"
vm-output-test-windows:
needs: [windows]
runs-on: windows-2022
steps:
- name: Download vmaware64_release
uses: actions/download-artifact@v4
with:
name: vmaware64_release.exe
path: build\vmaware64_release
- name: Check --detect = 1
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware64_release -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
$result = (& $bin --detect).Trim()
if ($result -ne "1") {
Write-Host "FAIL: --detect expected 1, got '$result'"
exit 1
}
Write-Host "PASS: --detect = $result"
- name: Check --percent = 100
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware64_release -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
$result = (& $bin --percent).Trim()
if ($result -ne "100") {
Write-Host "FAIL: --percent expected 100, got '$result'"
exit 1
}
Write-Host "PASS: --percent = $result"
- name: Check --brand = "Microsoft Azure Hyper-V"
shell: pwsh
run: |
$bin = Get-ChildItem build\vmaware64_release -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
$result = (& $bin --brand).Trim()
$expected = "Microsoft Azure Hyper-V"
if ($result -ne $expected) {
Write-Host "FAIL: --brand expected '$expected', got '$result'"
exit 1
}
Write-Host "PASS: --brand = $result"
platform-builds:
needs: [linux, macos, windows]
runs-on: ubuntu-latest
steps:
- run: echo "All platform builds completed"
cli-tests:
needs: [cli-test-linux, cli-test-macos, cli-test-windows]
runs-on: ubuntu-latest
steps:
- run: echo "All CLI tests completed"
vm-output-tests:
needs: [vm-output-test-linux, vm-output-test-macos, vm-output-test-windows]
runs-on: ubuntu-latest
steps:
- run: echo "All VM output tests completed"
completed:
needs: [platform-builds, cli-tests, memoize-test, vm-output-tests]
runs-on: ubuntu-latest
steps:
- run: echo "All checks passed"