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 $dir = "$env:APPDATA/vrubelroman/ChessPenguin/config" # Annotations: readable on the run page without signing in. $lines = @("exit code: $($p.ExitCode)") if (Test-Path "$dir/graphics") { $lines += "graphics: " + (Get-Content "$dir/graphics") } if (Test-Path "$dir/chesspenguin.log") { $lines += Get-Content "$dir/chesspenguin.log" | Select-Object -First 40 } foreach ($l in $lines) { Write-Output "::warning title=Windows start::$($l -replace '%','%25')" } 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-15 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::"