A Windows 10 user saw the program quit silently after SmartScreen: a Windows program has no console, so a failed graphics start left no trace. A start that fails or dies before its first frame now tries again without Vulkan, with OpenGL, then with software drawing (WARP), and keeps the mode that worked; what no mode overcomes, and any panic, goes to a message box and chesspenguin.log. The C runtime is linked statically (no VCRUNTIME140.dll needed); CI checks that and starts the window on the GPU-less Windows runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
73 lines
2.8 KiB
YAML
73 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: System libraries
|
|
run: sudo apt-get update && sudo apt-get install -y pkg-config libasound2-dev libxkbcommon-dev libwayland-dev
|
|
- run: cargo fmt --all --check
|
|
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
- run: cargo test --workspace --locked
|
|
|
|
windows-build:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo build --release --locked -p chesspenguin
|
|
# Self-update: replacing the running executable (the Windows rename scheme).
|
|
- run: "cargo test --release --locked -p chesspenguin update::"
|
|
# The C runtime is inside the executable (.cargo/config.toml): no VCRUNTIME140.dll.
|
|
- name: No Visual C++ runtime needed
|
|
shell: pwsh
|
|
run: |
|
|
$bytes = [IO.File]::ReadAllBytes("target/release/chesspenguin.exe")
|
|
$text = [Text.Encoding]::ASCII.GetString($bytes)
|
|
if ($text -match "(?i)vcruntime140\.dll") { throw "chesspenguin.exe imports VCRUNTIME140.dll" }
|
|
# The window starts on a machine without a graphics card (the runner): the log says
|
|
# which graphics mode it took. Informational for now.
|
|
- name: Start the window
|
|
shell: pwsh
|
|
continue-on-error: true
|
|
run: |
|
|
$env:CP_SCREENSHOT = "$PWD/start.png"
|
|
$env:CP_SCREENSHOT_DELAY = "5"
|
|
$p = Start-Process target/release/chesspenguin.exe -PassThru
|
|
$p | Wait-Process -Timeout 90 -ErrorAction SilentlyContinue
|
|
Get-Process chesspenguin -ErrorAction SilentlyContinue | Stop-Process -Force
|
|
$log = "$env:APPDATA/vrubelroman/ChessPenguin/config/chesspenguin.log"
|
|
if (Test-Path $log) { Get-Content $log }
|
|
Get-Content "$env:APPDATA/vrubelroman/ChessPenguin/config/graphics" -ErrorAction SilentlyContinue
|
|
if (-not (Test-Path start.png)) { throw "no screenshot: the window did not start" }
|
|
- uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: windows-start
|
|
path: start.png
|
|
if-no-files-found: ignore
|
|
|
|
# Apple Silicon: the build and the app bundle (decision 15).
|
|
macos-build:
|
|
runs-on: macos-14
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- run: cargo build --release --locked -p chesspenguin
|
|
- run: VERSION=0.0.0 packaging/macos/build-app.sh dist
|
|
- run: "cargo test --locked -p chesspenguin update::"
|