1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00
Files
BakaShrot/test.ps1
T
aziascreations 25ab88aa91 Hardened CI, Split the image push, Kept latest for releases only
The workflow's token is read-only but in the Docker jobs, where it's
only given to docker login after the image is built and checked; it goes
through env, never into a script. Checkouts don't keep it on disk (a
crate's build script can't read it), the actions are pinned to their
commits (checkout, setup-python and upload-artifact v7, on Node 24),
cargo builds with --locked (test.ps1 too), every job has a time limit,
and the image tag is checked before use. latest only moves for versions
without a "-". The login and the push are separate steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:35:08 +01:00

30 lines
1.0 KiB
PowerShell

# Runs what CI runs (.github/workflows/ci.yml), in this order:
# formatting, clippy (warnings are errors), the tests, the docs.
# Exit code 0 when everything passed.
# Usage: powershell -ExecutionPolicy Bypass -File test.ps1
$ErrorActionPreference = "Stop"
# rustup's folder isn't always on the PATH (it isn't in every shell here).
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {
$env:PATH = (Join-Path $env:USERPROFILE ".cargo\bin") + [IO.Path]::PathSeparator + $env:PATH
}
function Step([string]$What, [scriptblock]$Run) {
"== $What"
& $Run
if ($LASTEXITCODE -ne 0) { "FAILED: $What"; exit 1 }
}
Push-Location $PSScriptRoot
try {
Step "cargo fmt" { cargo fmt --all -- --check }
Step "cargo clippy" { cargo clippy --locked --workspace --all-targets --all-features -- -D warnings }
Step "cargo test" { cargo test --locked --workspace --all-features }
$env:RUSTDOCFLAGS = "-D warnings"
Step "cargo doc" { cargo doc --locked --workspace --no-deps --all-features }
} finally {
Pop-Location
}
"All checks passed"
exit 0