Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 105 additions & 5 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ jobs:
include:
- os: ubuntu-latest
name: linux-x64
build_cmd: ./build.sh release-tests
build_cmd: ./build.sh release-tests && ./build.sh release-examples
build_dir: build-release
- os: ubuntu-24.04-arm
name: linux-arm64
build_cmd: ./build.sh release-tests
build_cmd: ./build.sh release-tests && ./build.sh release-examples
build_dir: build-release
- os: macos-latest
name: macos-arm64
build_cmd: ./build.sh release-tests
build_cmd: ./build.sh release-tests && ./build.sh release-examples
build_dir: build-release
- os: macos-latest
name: macos-x64
build_cmd: ./build.sh release-tests --macos-arch x86_64
build_cmd: ./build.sh release-tests && ./build.sh release-examples --macos-arch x86_64
build_dir: build-release
- os: windows-latest
name: windows-x64
build_cmd: .\build.cmd release-tests
build_cmd: .\build.cmd release-tests && .\build.cmd release-examples
build_dir: build-release

name: Build (${{ matrix.name }})
Expand Down Expand Up @@ -181,6 +181,106 @@ jobs:
shell: pwsh
run: ${{ matrix.build_cmd }}

# ---------- Smoke test cpp-example-collection binaries ----------
# Built under cpp-example-collection-build/ (not build-dir/bin). Visual Studio
# multi-config places executables in per-target Release/ (or Debug/) subdirs.
- name: Smoke test examples (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -x
failed=false
examples_base="${{ matrix.build_dir }}/cpp-example-collection-build"
resolve_exe() {
local dir="$1" name="$2"
local p="${examples_base}/${dir}/${name}"
if [[ -x "${p}" ]]; then
printf '%s' "${p}"
return 0
fi
p="${examples_base}/${dir}/Release/${name}"
if [[ -x "${p}" ]]; then
printf '%s' "${p}"
return 0
fi
return 1
}
for pair in "SimpleRoom:simple_room" "SimpleRpc:simple_rpc" "SimpleDataStream:simple_data_stream"; do
exe="${pair%%:*}"
dir="${pair#*:}"
if ! exe_path="$(resolve_exe "${dir}" "${exe}")"; then
echo "ERROR: ${exe} not found under ${examples_base}/${dir}/"
failed=true
continue
fi
echo "Testing ${exe}..."
output=$("${exe_path}" --help 2>&1) || true
if [[ -z "${output}" ]]; then
echo "ERROR: ${exe} produced no output"
failed=true
else
echo "${output}"
echo "${exe} ran successfully"
fi
done
if [[ "$failed" == "true" ]]; then exit 1; fi

- name: Smoke test examples (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = 'Continue'
$examplesBase = "${{ matrix.build_dir }}/cpp-example-collection-build"
$examples = @(
@{ Name = 'SimpleRoom'; Dir = 'simple_room' },
@{ Name = 'SimpleRpc'; Dir = 'simple_rpc' },
@{ Name = 'SimpleDataStream'; Dir = 'simple_data_stream' }
)
$failed = $false
foreach ($ex in $examples) {
$name = $ex.Name
$dir = $ex.Dir
$inDir = Join-Path $examplesBase $dir
$candidates = @(
(Join-Path $inDir "$name.exe"),
(Join-Path (Join-Path $inDir 'Release') "$name.exe")
)
$exePath = $null
foreach ($p in $candidates) {
if (Test-Path -LiteralPath $p) {
$exePath = $p
break
}
}
if ($null -ne $exePath) {
Write-Host "Testing ${name}..."
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = $exePath
$pinfo.Arguments = "--help"
$pinfo.RedirectStandardOutput = $true
$pinfo.RedirectStandardError = $true
$pinfo.UseShellExecute = $false
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$stdout = $p.StandardOutput.ReadToEnd()
$stderr = $p.StandardError.ReadToEnd()
$p.WaitForExit()
$output = $stdout + $stderr
if ([string]::IsNullOrWhiteSpace($output)) {
Write-Host "ERROR: ${name} produced no output"
$failed = $true
} else {
Write-Host $output
Write-Host "${name} ran successfully"
}
} else {
Write-Host "ERROR: ${name} not found under ${examplesBase}/${dir}/"
$failed = $true
}
}
if ($failed) { exit 1 } else { exit 0 }

# ---------- Run unit tests ----------
- name: Run unit tests (Unix)
if: runner.os != 'Windows'
Expand Down