Build, test and release the Windows build in CI
- ci/windows-ci.sh is the one definition of every Windows step (toolchain, clippy, build, tests and UI self-test under Wine, packaging, test bundle); verify, release and next only call it. - release.yml: a windows job builds, tests and packages alkane-toolkit-vX.Y.Z-windows-x86_64.zip; the release job waits for it and attaches the zip next to the Linux tarball. next.yml does the same for -rc candidates, verify.yml runs the Windows gates on PRs. - windows-native.yml (advisory, never gates a release) runs main's cross-built unit tests and UI self-test on real Windows 11 through the self-hosted VM runner (label alkane-windows). - CI image: ci/images/alkane-ci.Dockerfile layers mingw-w64, Wine with a ready prefix, the rustup target and a prebuilt wxMSW prefix on the previously verified image; ci/images/build-image.sh pushes it and pins the digest. wx prefix/cache scripts take a linux|windows argument. - CI checks the wx-rs patch queue; versioning treats the GUI build script, Windows resources and assets as release-relevant; the workflow contract test covers the Windows gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ jobs:
|
||||
publish:
|
||||
runs-on: alkane-verify
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
|
||||
@@ -9,7 +9,7 @@ jobs:
|
||||
publish:
|
||||
runs-on: alkane-verify
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
permissions:
|
||||
actions: read
|
||||
contents: write
|
||||
|
||||
@@ -12,10 +12,75 @@ permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
candidate:
|
||||
# Windows build of the candidate (see release.yml's windows job); the
|
||||
# candidate job attaches its zip next to the Linux tarball.
|
||||
windows:
|
||||
runs-on: alkane-ci
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
env:
|
||||
CARGO_TARGET_DIR: target
|
||||
CARGO_BUILD_JOBS: 2
|
||||
WX_WINDOWS_PREFIX: /root/.cache/wx-3.3.3-mingw
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Select candidate version
|
||||
id: version
|
||||
run: bash ci/compute-rc-version.sh >> "$GITHUB_OUTPUT"
|
||||
- name: Install Windows toolchain
|
||||
if: steps.version.outputs.release == 'true'
|
||||
run: bash ci/windows-ci.sh toolchain
|
||||
- name: Configure bounded Rust compiler cache
|
||||
if: steps.version.outputs.release == 'true'
|
||||
run: bash ci/configure-rust-cache.sh
|
||||
- name: Compute wxMSW cache key
|
||||
if: steps.version.outputs.release == 'true'
|
||||
id: wx-key
|
||||
run: bash ci/wx-cache-key.sh windows
|
||||
- name: Check prebuilt wxMSW
|
||||
if: steps.version.outputs.release == 'true'
|
||||
id: wx-image
|
||||
run: bash ci/check-wx-image-prefix.sh windows
|
||||
- id: wx-cache
|
||||
if: steps.version.outputs.release == 'true' && steps.wx-image.outputs.available != 'true'
|
||||
uses: actions/cache/restore@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: /root/.cache/wx-3.3.3-mingw
|
||||
key: ${{ steps.wx-key.outputs.key }}
|
||||
- name: Build wxMSW
|
||||
if: steps.version.outputs.release == 'true'
|
||||
id: wx-build
|
||||
run: bash ci/ensure-wx-prefix.sh windows
|
||||
- name: Save vendored wxMSW build
|
||||
if: steps.version.outputs.release == 'true' && steps.wx-cache.outputs.cache-hit != 'true' && steps.wx-build.outputs.built == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: /root/.cache/wx-3.3.3-mingw
|
||||
key: ${{ steps.wx-key.outputs.key }}
|
||||
- name: Build Windows candidate
|
||||
if: steps.version.outputs.release == 'true'
|
||||
run: bash ci/windows-ci.sh build
|
||||
- name: Package Windows candidate
|
||||
if: steps.version.outputs.release == 'true'
|
||||
run: bash ci/windows-ci.sh package "${{ steps.version.outputs.version }}"
|
||||
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
|
||||
if: steps.version.outputs.release == 'true'
|
||||
with:
|
||||
name: alkane-toolkit-windows
|
||||
path: dist/alkane-toolkit-v*-windows-x86_64.zip
|
||||
- name: Clean generated Toolkit build
|
||||
if: always()
|
||||
run: python3 ci/cleanup-generated.py
|
||||
|
||||
candidate:
|
||||
needs: windows
|
||||
runs-on: alkane-ci
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
env:
|
||||
CARGO_TARGET_DIR: target
|
||||
CARGO_BUILD_JOBS: 2
|
||||
@@ -65,11 +130,23 @@ jobs:
|
||||
mkdir -p dist
|
||||
cp target/release/alkane-toolkit dist/
|
||||
tar -C dist -czf "dist/alkane-toolkit-${{ steps.version.outputs.version }}-linux-x86_64.tar.gz" alkane-toolkit
|
||||
- name: Fetch Windows candidate
|
||||
if: steps.version.outputs.release == 'true'
|
||||
uses: https://github.com/ChristopherHX/gitea-download-artifact@75635f32b4c1c41c4b3d64e8f85210112ed4c9c7
|
||||
with:
|
||||
name: alkane-toolkit-windows
|
||||
path: dist/windows
|
||||
- name: Create private prerelease
|
||||
if: steps.version.outputs.release == 'true'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: python3 ci/release-rc.py "${{ steps.version.outputs.tag }}" true "dist/alkane-toolkit-${{ steps.version.outputs.version }}-linux-x86_64.tar.gz"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
V="${{ steps.version.outputs.version }}"
|
||||
WIN="dist/windows/alkane-toolkit-v${V}-windows-x86_64.zip"
|
||||
[ -s "$WIN" ] || { echo "Windows candidate for ${V} is missing" >&2; exit 1; }
|
||||
python3 ci/release-rc.py "${{ steps.version.outputs.tag }}" true \
|
||||
"dist/alkane-toolkit-${V}-linux-x86_64.tar.gz" "$WIN"
|
||||
- name: Rust compiler cache statistics
|
||||
if: always()
|
||||
run: |
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
name: build-test-release
|
||||
|
||||
# Runs on every merge/push to main: build the GUI, run tests + a microbenchmark,
|
||||
# and (when the change warrants it) cut an X.Y.Z release with the binary attached.
|
||||
# Runs on every merge/push to main: build the GUI for Linux and Windows, run the
|
||||
# tests + a microbenchmark, and (when the change warrants it) cut an X.Y.Z
|
||||
# release with both binaries attached.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
@@ -15,10 +16,111 @@ permissions:
|
||||
actions: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
# Windows build of the same commit: cross-compiled with mingw-w64 against the
|
||||
# vendored wxMSW, unit-tested and UI-self-tested under Wine, packaged as a
|
||||
# zip. The release job below waits for it and attaches the zip next to the
|
||||
# Linux tarball, so a release never ships one platform without the other.
|
||||
windows:
|
||||
runs-on: alkane-ci
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
env:
|
||||
CARGO_TARGET_DIR: target
|
||||
CARGO_BUILD_JOBS: 2
|
||||
WX_WINDOWS_PREFIX: /root/.cache/wx-3.3.3-mingw
|
||||
steps:
|
||||
- name: Checkout (full history for tags)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Compute version
|
||||
id: ver
|
||||
run: bash ci/compute-version.sh | tee -a "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Install Windows toolchain
|
||||
run: bash ci/windows-ci.sh toolchain
|
||||
|
||||
- name: Configure bounded Rust compiler cache
|
||||
run: bash ci/configure-rust-cache.sh
|
||||
|
||||
- name: Compute wxMSW cache key
|
||||
id: wx-key
|
||||
run: bash ci/wx-cache-key.sh windows
|
||||
|
||||
- name: Check prebuilt wxMSW
|
||||
id: wx-image
|
||||
run: bash ci/check-wx-image-prefix.sh windows
|
||||
|
||||
- name: Cache vendored wxMSW build
|
||||
if: steps.wx-image.outputs.available != 'true'
|
||||
id: wx-cache
|
||||
uses: actions/cache/restore@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: /root/.cache/wx-3.3.3-mingw
|
||||
key: ${{ steps.wx-key.outputs.key }}
|
||||
|
||||
- name: Build wxMSW (once, then cached)
|
||||
id: wx-build
|
||||
run: bash ci/ensure-wx-prefix.sh windows
|
||||
|
||||
- name: Save vendored wxMSW build
|
||||
if: steps.wx-cache.outputs.cache-hit != 'true' && steps.wx-build.outputs.built == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: /root/.cache/wx-3.3.3-mingw
|
||||
key: ${{ steps.wx-key.outputs.key }}
|
||||
|
||||
- name: Clippy (Windows target, warnings are errors)
|
||||
run: bash ci/windows-ci.sh clippy
|
||||
|
||||
- name: Set crate version to ${{ steps.ver.outputs.version }}
|
||||
if: steps.ver.outputs.release == 'true'
|
||||
run: |
|
||||
sed -i "0,/^version = \".*\"/s//version = \"${{ steps.ver.outputs.version }}\"/" Cargo.toml
|
||||
grep -m1 '^version' Cargo.toml
|
||||
|
||||
- name: Build release (Windows)
|
||||
run: bash ci/windows-ci.sh build
|
||||
|
||||
- name: Unit tests (Windows build, under Wine)
|
||||
run: bash ci/windows-ci.sh test
|
||||
|
||||
- name: Headless UI self-test (Windows build, under Wine)
|
||||
run: bash ci/windows-ci.sh selftest
|
||||
|
||||
- name: Package Windows artifact
|
||||
if: steps.ver.outputs.release == 'true'
|
||||
run: bash ci/windows-ci.sh package "${{ steps.ver.outputs.version }}"
|
||||
|
||||
- name: Bundle Windows test executables
|
||||
run: bash ci/windows-ci.sh test-bundle
|
||||
|
||||
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
|
||||
if: steps.ver.outputs.release == 'true'
|
||||
with:
|
||||
name: alkane-toolkit-windows
|
||||
path: dist/alkane-toolkit-v*-windows-x86_64.zip
|
||||
|
||||
# Consumed by .gitea/workflows/windows-native.yml on the Windows VM runner.
|
||||
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7
|
||||
with:
|
||||
name: alkane-toolkit-windows-tests
|
||||
path: |
|
||||
dist/alkane-toolkit-windows-tests.zip
|
||||
target/x86_64-pc-windows-gnu/release/alkane-toolkit.exe
|
||||
|
||||
- name: Clean generated Toolkit build
|
||||
if: always()
|
||||
run: python3 ci/cleanup-generated.py
|
||||
|
||||
release:
|
||||
needs: windows
|
||||
runs-on: alkane-ci
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
env:
|
||||
CARGO_TARGET_DIR: target
|
||||
CARGO_BUILD_JOBS: 2
|
||||
@@ -35,10 +137,13 @@ jobs:
|
||||
- name: Check runner image pins
|
||||
run: python3 ci/check-runner-image.py
|
||||
|
||||
- name: Check wx-rs patch queue reproduces the patched tree
|
||||
run: python3 scripts/wx_rs_patches.py check
|
||||
|
||||
- name: Check first-party Rust formatting
|
||||
run: |
|
||||
rustup component add rustfmt >/dev/null
|
||||
cargo fmt -p alkane-gui -p alkane-artifacts -p alkane-flash -p alkane-cli -p alkane-access -- --check
|
||||
cargo fmt -p alkane-gui -p alkane-artifacts -p alkane-flash -p alkane-cli -p alkane-access -p alkane-core -- --check
|
||||
|
||||
|
||||
- name: Compute version
|
||||
@@ -224,11 +329,30 @@ jobs:
|
||||
echo "asset=dist/${NAME}.tar.gz" >> "$GITHUB_OUTPUT"
|
||||
echo "assetname=${NAME}.tar.gz" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Fetch Windows artifact
|
||||
if: steps.ver.outputs.release == 'true'
|
||||
uses: https://github.com/ChristopherHX/gitea-download-artifact@75635f32b4c1c41c4b3d64e8f85210112ed4c9c7
|
||||
with:
|
||||
name: alkane-toolkit-windows
|
||||
path: dist/windows
|
||||
|
||||
- name: Locate Windows artifact
|
||||
if: steps.ver.outputs.release == 'true'
|
||||
id: winpkg
|
||||
run: |
|
||||
set -euo pipefail
|
||||
V="${{ steps.ver.outputs.version }}"
|
||||
ZIP="dist/windows/alkane-toolkit-v${V}-windows-x86_64.zip"
|
||||
[ -s "$ZIP" ] || { echo "Windows artifact for v${V} is missing" >&2; ls -lR dist/windows >&2; exit 1; }
|
||||
echo "asset=$ZIP" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create Gitea release + upload artifact
|
||||
if: steps.ver.outputs.release == 'true'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: python3 ci/release-rc.py "${{ steps.ver.outputs.tag }}" false "${{ steps.pkg.outputs.asset }}"
|
||||
run: |
|
||||
python3 ci/release-rc.py "${{ steps.ver.outputs.tag }}" false \
|
||||
"${{ steps.pkg.outputs.asset }}" "${{ steps.winpkg.outputs.asset }}"
|
||||
|
||||
- name: No release needed
|
||||
if: steps.ver.outputs.release != 'true'
|
||||
|
||||
@@ -13,7 +13,7 @@ jobs:
|
||||
check:
|
||||
runs-on: alkane-fast
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
env:
|
||||
CARGO_BUILD_JOBS: 2
|
||||
steps:
|
||||
|
||||
@@ -13,7 +13,9 @@ jobs:
|
||||
verify:
|
||||
runs-on: alkane-verify
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
outputs:
|
||||
surface: ${{ steps.surface.outputs.surface }}
|
||||
env:
|
||||
CARGO_TARGET_DIR: target
|
||||
CARGO_BUILD_JOBS: 2
|
||||
@@ -28,6 +30,9 @@ jobs:
|
||||
- name: Check runner image pins
|
||||
run: python3 ci/check-runner-image.py
|
||||
|
||||
- name: Check wx-rs patch queue reproduces the patched tree
|
||||
run: python3 scripts/wx_rs_patches.py check
|
||||
|
||||
- name: Detect changed surface
|
||||
id: surface
|
||||
run: python3 ci/pr-surface.py >> "$GITHUB_OUTPUT"
|
||||
@@ -53,7 +58,7 @@ jobs:
|
||||
if: steps.surface.outputs.surface == 'headless' || steps.surface.outputs.surface == 'full'
|
||||
run: |
|
||||
rustup component add rustfmt >/dev/null
|
||||
cargo fmt -p alkane-gui -p alkane-artifacts -p alkane-flash -p alkane-cli -p alkane-access -- --check
|
||||
cargo fmt -p alkane-gui -p alkane-artifacts -p alkane-flash -p alkane-cli -p alkane-access -p alkane-core -- --check
|
||||
|
||||
|
||||
- name: Check workflow-only change
|
||||
@@ -184,3 +189,74 @@ jobs:
|
||||
- name: Clean generated Toolkit build
|
||||
if: always()
|
||||
run: python3 ci/cleanup-generated.py
|
||||
|
||||
# The Windows build of the same change (main's release gate, run on the PR):
|
||||
# clippy for the Windows target, the release .exe, every unit test under
|
||||
# Wine, and the headless UI self-test under Wine. Only for changes that can
|
||||
# affect the binary (the "full" surface).
|
||||
verify-windows:
|
||||
needs: verify
|
||||
if: needs.verify.outputs.surface == 'full'
|
||||
runs-on: alkane-verify
|
||||
container:
|
||||
image: gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
env:
|
||||
CARGO_TARGET_DIR: target
|
||||
CARGO_BUILD_JOBS: 2
|
||||
WX_WINDOWS_PREFIX: /root/.cache/wx-3.3.3-mingw
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Windows toolchain
|
||||
run: bash ci/windows-ci.sh toolchain
|
||||
|
||||
- name: Configure bounded Rust compiler cache
|
||||
run: bash ci/configure-rust-cache.sh
|
||||
|
||||
- name: Compute wxMSW cache key
|
||||
id: wx-key
|
||||
run: bash ci/wx-cache-key.sh windows
|
||||
|
||||
- name: Check prebuilt wxMSW
|
||||
id: wx-image
|
||||
run: bash ci/check-wx-image-prefix.sh windows
|
||||
|
||||
- name: Cache vendored wxMSW build
|
||||
if: steps.wx-image.outputs.available != 'true'
|
||||
id: wx-cache
|
||||
uses: actions/cache/restore@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: /root/.cache/wx-3.3.3-mingw
|
||||
key: ${{ steps.wx-key.outputs.key }}
|
||||
|
||||
- name: Build wxMSW (once, then cached)
|
||||
id: wx-build
|
||||
run: bash ci/ensure-wx-prefix.sh windows
|
||||
|
||||
- name: Save vendored wxMSW build
|
||||
if: steps.wx-cache.outputs.cache-hit != 'true' && steps.wx-build.outputs.built == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: /root/.cache/wx-3.3.3-mingw
|
||||
key: ${{ steps.wx-key.outputs.key }}
|
||||
|
||||
- name: Clippy (Windows target, warnings are errors)
|
||||
run: bash ci/windows-ci.sh clippy
|
||||
|
||||
- name: Build (Windows)
|
||||
run: bash ci/windows-ci.sh build
|
||||
|
||||
- name: Unit tests (Windows build, under Wine)
|
||||
run: bash ci/windows-ci.sh test
|
||||
|
||||
- name: Headless UI self-test (Windows build, under Wine)
|
||||
run: bash ci/windows-ci.sh selftest
|
||||
|
||||
- name: Clean generated Toolkit build
|
||||
if: always()
|
||||
run: python3 ci/cleanup-generated.py
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
name: windows-native
|
||||
|
||||
# Smoke test on real Windows. The self-hosted runner in the Windows 11 test VM
|
||||
# (label alkane-windows, host mode; see docs/windows.md) takes the Windows
|
||||
# build that main's build-test-release run cross-compiled -- the release .exe
|
||||
# and every unit-test executable, which already passed under Wine there -- and
|
||||
# runs them natively: real Win32, real comctl32/visual styles, real DPI and
|
||||
# real Windows networking.
|
||||
#
|
||||
# Advisory by design: a separate workflow, so it never gates or delays a
|
||||
# release, and while the VM is off the job simply waits for the runner.
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [build-test-release]
|
||||
types: [completed]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run_id:
|
||||
description: build-test-release run whose Windows build to test
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
native:
|
||||
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: alkane-windows
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
RUN_ID: ${{ github.event.workflow_run.id || inputs.run_id }}
|
||||
steps:
|
||||
- name: Fetch the cross-built Windows build
|
||||
shell: powershell
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
API: ${{ github.api_url }}/repos/${{ github.repository }}
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$work = Join-Path ([IO.Path]::GetTempPath()) "alkane-native-$env:RUN_ID"
|
||||
Remove-Item -Recurse -Force $work -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType Directory $work | Out-Null
|
||||
$auth = @{ Authorization = "token $env:TOKEN" }
|
||||
$list = Invoke-RestMethod -Headers $auth "$env:API/actions/runs/$env:RUN_ID/artifacts"
|
||||
$art = $list.artifacts | Where-Object { $_.name -eq 'alkane-toolkit-windows-tests' } |
|
||||
Select-Object -First 1
|
||||
if (-not $art) { throw "run $env:RUN_ID has no alkane-toolkit-windows-tests artifact" }
|
||||
Invoke-WebRequest -Headers $auth -Uri $art.archive_download_url -OutFile "$work\artifact.zip"
|
||||
Expand-Archive "$work\artifact.zip" "$work\artifact"
|
||||
$bundle = Get-ChildItem -Recurse "$work\artifact" -Filter alkane-toolkit-windows-tests.zip |
|
||||
Select-Object -First 1
|
||||
Expand-Archive $bundle.FullName "$work\tests"
|
||||
$exe = Get-ChildItem -Recurse "$work\artifact" -Filter alkane-toolkit.exe | Select-Object -First 1
|
||||
Copy-Item $exe.FullName "$work\alkane-toolkit.exe"
|
||||
"ALKANE_NATIVE=$work" | Out-File -Append -Encoding utf8 $env:GITHUB_ENV
|
||||
$os = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
|
||||
"Testing run $env:RUN_ID on Windows $($os.DisplayVersion) build $($os.CurrentBuild)"
|
||||
|
||||
- name: Unit tests (native Windows)
|
||||
shell: powershell
|
||||
run: |
|
||||
$failed = @()
|
||||
foreach ($test in Get-Content "$env:ALKANE_NATIVE\tests\tests.txt") {
|
||||
Write-Host "== $test"
|
||||
& "$env:ALKANE_NATIVE\tests\$test"
|
||||
if ($LASTEXITCODE -ne 0) { $failed += $test }
|
||||
}
|
||||
if ($failed) { Write-Host "FAILED: $($failed -join ', ')"; exit 1 }
|
||||
|
||||
- name: Headless UI self-test (native Windows)
|
||||
shell: powershell
|
||||
run: |
|
||||
# A GUI-subsystem executable: wait for it and read its redirected output.
|
||||
$env:ALKANE_SELFTEST = '1'
|
||||
$out = "$env:ALKANE_NATIVE\selftest.txt"
|
||||
$p = Start-Process -FilePath "$env:ALKANE_NATIVE\alkane-toolkit.exe" -Wait -PassThru `
|
||||
-NoNewWindow -RedirectStandardOutput $out -RedirectStandardError "$out.err"
|
||||
Get-Content $out, "$out.err"
|
||||
if ($p.ExitCode -ne 0) { exit $p.ExitCode }
|
||||
|
||||
- name: Remove the downloaded build
|
||||
if: always()
|
||||
shell: powershell
|
||||
run: |
|
||||
if ($env:ALKANE_NATIVE) { Remove-Item -Recurse -Force $env:ALKANE_NATIVE -ErrorAction SilentlyContinue }
|
||||
@@ -1,15 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Avoid a runner-local cache download when the pinned image has this source.
|
||||
# check-wx-image-prefix.sh [linux|windows]
|
||||
set -euo pipefail
|
||||
|
||||
prefix="${WX_PREFIX:?WX_PREFIX is required}"
|
||||
case "${1:-linux}" in
|
||||
linux) prefix="${WX_PREFIX:?WX_PREFIX is required}"; library=lib/libwx_gtk3u-3.3.a ;;
|
||||
windows) prefix="${WX_WINDOWS_PREFIX:?WX_WINDOWS_PREFIX is required}"
|
||||
library=lib/libwx_mswu-3.3-x86_64-w64-mingw32.a ;;
|
||||
*) echo "unknown wx platform: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
expected="$(awk '$1 == "sha256:" {print $2}' thirdparty/wxwidgets/VERSION)"
|
||||
[[ "$expected" =~ ^[0-9a-f]{64}$ ]]
|
||||
available=false
|
||||
if [ ! -L "$prefix" ] && [ ! -L "$prefix/.alkane-source-sha256" ] &&
|
||||
[ -x "$prefix/bin/wx-config" ] &&
|
||||
[ -s "$prefix/lib/libwx_gtk3u-3.3.a" ] &&
|
||||
[ -s "$prefix/$library" ] &&
|
||||
[ "$(cat "$prefix/.alkane-source-sha256" 2>/dev/null || true)" = "$expected" ]; then
|
||||
available=true
|
||||
fi
|
||||
|
||||
@@ -36,10 +36,14 @@ crates/alkane-gui/src/bin/*)
|
||||
ui=true ;;
|
||||
crates/alkane-core/*|crates/alkane-discovery/*|crates/alkane-access/*|\
|
||||
crates/alkane-flash/*|crates/alkane-artifacts/*|crates/alkane-cli/*|\
|
||||
crates/alkane-gui/src/*|Cargo.toml|Cargo.lock|.gitea/*|ci/*|scripts/*|\
|
||||
crates/alkane-gui/src/*|crates/alkane-gui/Cargo.toml|crates/alkane-gui/build.rs|\
|
||||
crates/alkane-gui/windows/*|crates/alkane-gui/assets/*|\
|
||||
Cargo.toml|Cargo.lock|.gitea/*|ci/*|scripts/*|\
|
||||
vendor/*|thirdparty/asic-rs/*)
|
||||
# Any other GUI source file (naming, scan, model, pool_prefs, restore,
|
||||
# access_probe, credentials, ...) is backend logic. ui.rs/fixtures.rs/bin
|
||||
# access_probe, credentials, ...) is backend logic, as is how the binary
|
||||
# is built and packaged (build.rs, the Windows manifest/icon/version
|
||||
# resources, embedded assets). ui.rs/fixtures.rs/bin
|
||||
# match the UI arm above first, so they still bump Z, not Y.
|
||||
backend=true ;;
|
||||
*) : ;; # docs, HANDOFF, README, thirdparty/wxwidgets tree: no bump
|
||||
|
||||
@@ -3,13 +3,17 @@
|
||||
# Use the preinstalled CI image or install missing packages on older runners.
|
||||
set -euo pipefail
|
||||
|
||||
mode="${1:?usage: ensure-build-deps.sh base|ui|all|ssh}"
|
||||
mode="${1:?usage: ensure-build-deps.sh base|ui|all|ssh|windows}"
|
||||
case "$mode" in
|
||||
base) packages=(libssl-dev pkg-config ca-certificates) ;;
|
||||
ui) packages=(xvfb xauth dbus-x11 fonts-dejavu-core) ;;
|
||||
ssh) packages=(openssh-client) ;;
|
||||
all) packages=(libssl-dev pkg-config ca-certificates openssh-client
|
||||
xvfb xauth dbus-x11 fonts-dejavu-core) ;;
|
||||
# Windows cross build (mingw-w64, posix threads) + Wine for its tests.
|
||||
windows) packages=(libssl-dev pkg-config ca-certificates
|
||||
gcc-mingw-w64-x86-64-posix g++-mingw-w64-x86-64-posix
|
||||
binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev wine wine64 xvfb xauth) ;;
|
||||
*) echo "unknown dependency set: $mode" >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
|
||||
+21
-6
@@ -1,9 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Use the matching image or cache prefix; rebuild after a vendored source bump.
|
||||
# ensure-wx-prefix.sh [linux|windows] (default linux: wxGTK in $WX_PREFIX;
|
||||
# windows: the mingw wxMSW prefix in $WX_WINDOWS_PREFIX)
|
||||
set -euo pipefail
|
||||
|
||||
prefix="${WX_PREFIX:?WX_PREFIX is required}"
|
||||
platform="${1:-linux}"
|
||||
case "$platform" in
|
||||
linux)
|
||||
prefix="${WX_PREFIX:?WX_PREFIX is required}"
|
||||
allowed=/root/.cache/wx-3.3.3-linux
|
||||
library=lib/libwx_gtk3u-3.3.a
|
||||
build=scripts/build-wx-linux.sh ;;
|
||||
windows)
|
||||
prefix="${WX_WINDOWS_PREFIX:?WX_WINDOWS_PREFIX is required}"
|
||||
allowed=/root/.cache/wx-3.3.3-mingw
|
||||
library=lib/libwx_mswu-3.3-x86_64-w64-mingw32.a
|
||||
build=scripts/build-wx-windows.sh ;;
|
||||
*) echo "unknown wx platform: $platform" >&2; exit 2 ;;
|
||||
esac
|
||||
if [ -L "$prefix" ] || [ -L "$prefix/.alkane-source-sha256" ]; then
|
||||
echo 'refusing symlinked wxWidgets prefix or source marker' >&2
|
||||
exit 1
|
||||
@@ -15,13 +30,13 @@ expected="$(awk '$1 == "sha256:" {print $2}' thirdparty/wxwidgets/VERSION)"
|
||||
}
|
||||
marker="$prefix/.alkane-source-sha256"
|
||||
if [ -e "$marker" ] && [ "$(cat "$marker")" != "$expected" ]; then
|
||||
python3 - "$prefix" <<'PY'
|
||||
python3 - "$prefix" "$allowed" <<'PY'
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
prefix = Path(sys.argv[1])
|
||||
allowed = Path('/root/.cache/wx-3.3.3-linux')
|
||||
allowed = Path(sys.argv[2])
|
||||
if prefix != allowed or prefix.is_symlink():
|
||||
raise SystemExit('refusing unsafe wxWidgets prefix reset')
|
||||
if prefix.is_dir():
|
||||
@@ -30,13 +45,13 @@ PY
|
||||
fi
|
||||
built=false
|
||||
if [ ! -x "$prefix/bin/wx-config" ] ||
|
||||
[ ! -s "$prefix/lib/libwx_gtk3u-3.3.a" ]; then
|
||||
bash scripts/build-wx-linux.sh
|
||||
[ ! -s "$prefix/$library" ]; then
|
||||
WX_WINDOWS_PREFIX="$prefix" sh "$build"
|
||||
built=true
|
||||
else
|
||||
echo 'wx prefix available from matching image or cache'
|
||||
fi
|
||||
[ -s "$prefix/lib/libwx_gtk3u-3.3.a" ]
|
||||
[ -s "$prefix/$library" ]
|
||||
printf '%s\n' "$expected" > "$marker"
|
||||
if [ -n "${GITHUB_OUTPUT:-}" ]; then
|
||||
printf 'built=%s\n' "$built" >> "$GITHUB_OUTPUT"
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Alkane Toolkit CI image (ci/runner-image.txt pins the pushed digest).
|
||||
#
|
||||
# Layered on the previously verified image, so every Linux job keeps exactly
|
||||
# the toolchain it had (Rust 1.97.1, prebuilt wxGTK prefix, sccache,
|
||||
# cargo-llvm-cov), and adds what the Windows jobs need:
|
||||
# - mingw-w64 (posix threads) and the rustup target x86_64-pc-windows-gnu
|
||||
# - a prebuilt static wxMSW 3.3.3 prefix, built from the vendored source by
|
||||
# scripts/build-wx-windows.sh and stamped with the source digest the same
|
||||
# way as the wxGTK prefix (ci/ensure-wx-prefix.sh rebuilds on a mismatch)
|
||||
# - Wine with an initialised prefix, to run the Windows tests and self-test
|
||||
#
|
||||
# Build and push from the workstation with ci/images/build-image.sh.
|
||||
ARG BASE=gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
|
||||
FROM ${BASE}
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
|
||||
gcc-mingw-w64-x86-64-posix g++-mingw-w64-x86-64-posix \
|
||||
binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev \
|
||||
wine wine64 xvfb xauth \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN rustup target add x86_64-pc-windows-gnu
|
||||
|
||||
# The build context is the repository root, filtered by
|
||||
# alkane-ci.Dockerfile.dockerignore down to the wx source and its build script.
|
||||
COPY thirdparty/wxwidgets /tmp/alkane/thirdparty/wxwidgets
|
||||
COPY scripts/build-wx-windows.sh /tmp/alkane/scripts/build-wx-windows.sh
|
||||
RUN HOME=/root WX_WINDOWS_PREFIX=/root/.cache/wx-3.3.3-mingw \
|
||||
sh /tmp/alkane/scripts/build-wx-windows.sh \
|
||||
&& awk '$1 == "sha256:" {print $2}' /tmp/alkane/thirdparty/wxwidgets/VERSION \
|
||||
> /root/.cache/wx-3.3.3-mingw/.alkane-source-sha256 \
|
||||
&& rm -rf /tmp/alkane
|
||||
|
||||
# A ready Wine prefix saves ~10 s per job (scripts/wine-run.sh reuses it).
|
||||
RUN WINEPREFIX=/root/.cache/alkane-wine WINEDEBUG=-all \
|
||||
WINEDLLOVERRIDES='winemenubuilder.exe=d;mscoree=d;mshtml=d' \
|
||||
sh -c 'wineboot --init; wineboot --shutdown; wineserver -w' >/dev/null 2>&1; \
|
||||
test -f /root/.cache/alkane-wine/system.reg
|
||||
|
||||
RUN test -s /root/.cache/wx-3.3.3-mingw/lib/libwx_mswu-3.3-x86_64-w64-mingw32.a \
|
||||
&& test "$(/root/.cache/wx-3.3.3-mingw/bin/wx-config --version)" = 3.3.3 \
|
||||
&& test -s /root/.cache/wx-3.3.3-linux/lib/libwx_gtk3u-3.3.a \
|
||||
&& x86_64-w64-mingw32-g++-posix --version >/dev/null \
|
||||
&& wine --version \
|
||||
&& rustup target list --installed | grep -qx x86_64-pc-windows-gnu
|
||||
@@ -0,0 +1,4 @@
|
||||
# Only what the image build copies: the vendored wx tree and its build script.
|
||||
*
|
||||
!thirdparty/wxwidgets/**
|
||||
!scripts/build-wx-windows.sh
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# Build the CI image from ci/images/alkane-ci.Dockerfile, push it to the Gitea
|
||||
# registry, and pin the pushed digest in ci/runner-image.txt and every
|
||||
# workflow (ci/check-runner-image.py enforces the pin).
|
||||
#
|
||||
# Run on the workstation, which holds the registry credential; it is passed to
|
||||
# a throwaway Docker config that is deleted afterwards, never to a runner.
|
||||
# ci/images/build-image.sh TAG e.g. ci/images/build-image.sh windows-2026-11-02
|
||||
set -eu
|
||||
TAG=${1:?usage: build-image.sh TAG}
|
||||
REPO=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
|
||||
REGISTRY=gitea.bluefla.re
|
||||
IMAGE=$REGISTRY/blueflare/alkane-ci
|
||||
TOKEN_FILE=${GITEA_TOKEN_FILE:-$HOME/.config/gitea/token}
|
||||
cd "$REPO"
|
||||
DOCKER_CONFIG=$(mktemp -d)
|
||||
export DOCKER_CONFIG
|
||||
trap 'rm -rf "$DOCKER_CONFIG"' 0
|
||||
user=$(curl -sS --config - "https://$REGISTRY/api/v1/user" <<CFG | python3 -c 'import json,sys; print(json.load(sys.stdin)["login"])'
|
||||
header = "Authorization: token $(cat "$TOKEN_FILE")"
|
||||
CFG
|
||||
)
|
||||
docker login "$REGISTRY" -u "$user" --password-stdin < "$TOKEN_FILE" >/dev/null
|
||||
DOCKER_BUILDKIT=1 docker build -f ci/images/alkane-ci.Dockerfile -t "$IMAGE:$TAG" .
|
||||
docker push "$IMAGE:$TAG" >/dev/null
|
||||
digest=$(docker inspect --format '{{range .RepoDigests}}{{println .}}{{end}}' "$IMAGE:$TAG" \
|
||||
| grep "^$IMAGE@sha256:" | head -1)
|
||||
[ -n "$digest" ] || { echo "no registry digest for $IMAGE:$TAG" >&2; exit 1; }
|
||||
old=$(cat ci/runner-image.txt)
|
||||
printf '%s\n' "$digest" > ci/runner-image.txt
|
||||
grep -rl "$old" .gitea/workflows | while read -r f; do
|
||||
python3 - "$f" "$old" "$digest" <<'PY'
|
||||
import pathlib, sys
|
||||
p, old, new = pathlib.Path(sys.argv[1]), sys.argv[2], sys.argv[3]
|
||||
p.write_text(p.read_text().replace(old, new))
|
||||
PY
|
||||
done
|
||||
python3 ci/check-runner-image.py
|
||||
echo "pinned $digest"
|
||||
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: MIT
|
||||
"""Package the cross-built Windows toolkit for release and for native testing.
|
||||
|
||||
package-windows.py release VERSION EXE OUT_DIR
|
||||
dist/alkane-toolkit-vVERSION-windows-x86_64.zip: one folder holding
|
||||
alkane-toolkit.exe, LICENSE and a README.txt. Prints the zip path.
|
||||
|
||||
package-windows.py tests CARGO_JSON OUT_ZIP
|
||||
A bundle of the test executables `cargo test --no-run
|
||||
--message-format=json` reported (CARGO_JSON is that output), plus
|
||||
tests.txt naming each one. The native Windows job runs every listed
|
||||
executable on real Windows; the same binaries already ran under Wine.
|
||||
"""
|
||||
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
TARGET = "x86_64-pc-windows-gnu"
|
||||
|
||||
|
||||
def release(version: str, exe: str, out_dir: str) -> None:
|
||||
exe_path = pathlib.Path(exe)
|
||||
if exe_path.suffix != ".exe" or not exe_path.is_file():
|
||||
sys.exit(f"not a Windows executable: {exe}")
|
||||
name = f"alkane-toolkit-v{version}-windows-x86_64"
|
||||
out = pathlib.Path(out_dir) / f"{name}.zip"
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
readme = (
|
||||
f"alkane-toolkit v{version} (Windows x86_64)\r\n"
|
||||
"\r\n"
|
||||
"Run alkane-toolkit.exe. No installer and no extra runtime are needed:\r\n"
|
||||
"the executable is self-contained and runs on Windows 10 and 11.\r\n"
|
||||
"\r\n"
|
||||
"Settings are kept in %APPDATA%\\alkane-toolkit.\r\n"
|
||||
"SSH-based actions use the OpenSSH client built into Windows (ssh.exe);\r\n"
|
||||
"HTTP actions use curl.exe, also built in.\r\n"
|
||||
"\r\n"
|
||||
"Offline demo: run from a Command Prompt with\r\n"
|
||||
" set ALKANE_FAKE_SCAN=1 && alkane-toolkit.exe\r\n"
|
||||
)
|
||||
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as z:
|
||||
z.write(exe_path, f"{name}/alkane-toolkit.exe")
|
||||
z.write(ROOT / "LICENSE", f"{name}/LICENSE.txt")
|
||||
z.writestr(f"{name}/README.txt", readme)
|
||||
print(out)
|
||||
|
||||
|
||||
def tests(cargo_json: str, out_zip: str) -> None:
|
||||
executables = []
|
||||
for line in pathlib.Path(cargo_json).read_text().splitlines():
|
||||
try:
|
||||
message = json.loads(line)
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
if (message.get("reason") == "compiler-artifact"
|
||||
and message.get("profile", {}).get("test")
|
||||
and message.get("executable")):
|
||||
executables.append(pathlib.Path(message["executable"]))
|
||||
executables = sorted(set(executables))
|
||||
if not executables:
|
||||
sys.exit("no test executables in the cargo output")
|
||||
out = pathlib.Path(out_zip)
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as z:
|
||||
names = []
|
||||
for exe in executables:
|
||||
if exe.suffix != ".exe" or TARGET not in exe.parts:
|
||||
sys.exit(f"not a {TARGET} test executable: {exe}")
|
||||
z.write(exe, exe.name)
|
||||
names.append(exe.name)
|
||||
z.writestr("tests.txt", "\n".join(names) + "\n")
|
||||
print(f"{out} ({len(executables)} test executables)")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if len(sys.argv) == 5 and sys.argv[1] == "release":
|
||||
release(*sys.argv[2:])
|
||||
elif len(sys.argv) == 4 and sys.argv[1] == "tests":
|
||||
tests(*sys.argv[2:])
|
||||
else:
|
||||
sys.exit(__doc__)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+1
-1
@@ -1 +1 @@
|
||||
gitea.bluefla.re/blueflare/alkane-ci@sha256:9d2a992bbcb91014af3c85d2e1ec8c5990701cecf83fd06c8d46f9ef13dbd948
|
||||
gitea.bluefla.re/blueflare/alkane-ci@sha256:8f20439b38ae1c070b1a692a89c084f69134f4fa16a755d02783f621cd9ac041
|
||||
|
||||
@@ -53,6 +53,12 @@ R="$(new_repo)"; mkdir -p "$R/ci"; printf '2' > "$R/ci/version-x.txt"
|
||||
printf 'x' > "$R/README.md"; commit "$R" init
|
||||
run_case first_release_prebumped_x "$R" version=2.0.0 bump=initial release=true
|
||||
|
||||
# 3b. Windows packaging (build script / resources) is release-relevant: bumps Y
|
||||
R="$(new_repo)"; mkdir -p "$R/ci" "$R/crates/alkane-gui/windows"; printf '0' > "$R/ci/version-x.txt"
|
||||
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
|
||||
printf '<assembly/>' > "$R/crates/alkane-gui/windows/alkane-toolkit.exe.manifest"; commit "$R" winres
|
||||
run_case windows_resources_bump "$R" version=1.3.0 bump=backend release=true
|
||||
|
||||
# 3. Backend path change bumps Y
|
||||
R="$(new_repo)"; mkdir -p "$R/ci" "$R/crates/alkane-gui/src"; printf '0' > "$R/ci/version-x.txt"
|
||||
printf 'x' > "$R/README.md"; commit "$R" init; git -C "$R" tag v1.2.3
|
||||
|
||||
+24
-7
@@ -29,8 +29,8 @@ def git(directory: Path, *args: str) -> str:
|
||||
|
||||
def check_workflow_contract() -> None:
|
||||
"""Keep the short workflow check from silently dropping release gates."""
|
||||
required = {
|
||||
"release.yml": ("main", "release", (
|
||||
required = [
|
||||
("release.yml", "main", "release", (
|
||||
"Check runner image pins", "Check first-party Rust formatting",
|
||||
"Clippy (our crate, warnings are errors)",
|
||||
"Build release", "Unit tests", "Microbenchmarks",
|
||||
@@ -39,19 +39,35 @@ def check_workflow_contract() -> None:
|
||||
"Record private benchmark history", "Create Gitea release + upload artifact",
|
||||
"Clean generated Toolkit build",
|
||||
)),
|
||||
"next.yml": ("next", "candidate", (
|
||||
("release.yml", "main", "windows", (
|
||||
"Clippy (Windows target, warnings are errors)", "Build release (Windows)",
|
||||
"Unit tests (Windows build, under Wine)",
|
||||
"Headless UI self-test (Windows build, under Wine)",
|
||||
"Package Windows artifact", "Clean generated Toolkit build",
|
||||
)),
|
||||
("next.yml", "next", "candidate", (
|
||||
"Check runner image pins", "Build release candidate",
|
||||
"Create private prerelease", "Clean generated Toolkit build",
|
||||
)),
|
||||
"verify.yml": ("main", "verify", (
|
||||
("next.yml", "next", "windows", (
|
||||
"Build Windows candidate", "Package Windows candidate",
|
||||
"Clean generated Toolkit build",
|
||||
)),
|
||||
("verify.yml", "main", "verify", (
|
||||
"Check runner image pins", "Detect changed surface",
|
||||
"Check CI change surface", "Check first-party Rust formatting",
|
||||
"Check workflow-only change",
|
||||
"Clippy (our crate, warnings are errors)", "Build", "Unit tests",
|
||||
"Microbenchmarks", "Headless UI self-test", "Clean generated Toolkit build",
|
||||
)),
|
||||
}
|
||||
for filename, (branch, job_name, gates) in required.items():
|
||||
("verify.yml", "main", "verify-windows", (
|
||||
"Clippy (Windows target, warnings are errors)", "Build (Windows)",
|
||||
"Unit tests (Windows build, under Wine)",
|
||||
"Headless UI self-test (Windows build, under Wine)",
|
||||
"Clean generated Toolkit build",
|
||||
)),
|
||||
]
|
||||
for filename, branch, job_name, gates in required:
|
||||
path = ROOT / ".gitea/workflows" / filename
|
||||
workflow = yaml.load(path.read_text(), Loader=yaml.BaseLoader)
|
||||
event = "pull_request" if filename == "verify.yml" else "push"
|
||||
@@ -66,7 +82,8 @@ def check_workflow_contract() -> None:
|
||||
for gate, position in zip(gates[:-1], positions[:-1]):
|
||||
condition = steps[position].get("if")
|
||||
if gate in {"Create Gitea release + upload artifact",
|
||||
"Create private prerelease"}:
|
||||
"Create private prerelease", "Package Windows artifact",
|
||||
"Build Windows candidate", "Package Windows candidate"}:
|
||||
assert condition is not None and "release == 'true'" in condition, path
|
||||
elif filename == "verify.yml" and gate in {
|
||||
"Build", "Unit tests", "Microbenchmarks",
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Every Windows CI step in one place, so verify (PRs), the main release and the
|
||||
# next-branch candidates build and test the .exe the same way:
|
||||
#
|
||||
# windows-ci.sh toolchain mingw-w64 + Wine + the rustup target
|
||||
# windows-ci.sh clippy clippy for x86_64-pc-windows-gnu, -D warnings
|
||||
# windows-ci.sh build release alkane-toolkit.exe
|
||||
# windows-ci.sh test all unit tests, run under Wine
|
||||
# windows-ci.sh selftest headless UI self-test under Wine + Xvfb
|
||||
# windows-ci.sh package VERSION dist/alkane-toolkit-vVERSION-windows-x86_64.zip
|
||||
# windows-ci.sh test-bundle dist/alkane-toolkit-windows-tests.zip (for
|
||||
# the native Windows job)
|
||||
#
|
||||
# The wxMSW prefix comes from the CI image or ci/ensure-wx-prefix.sh windows.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
export WX_WINDOWS_PREFIX="${WX_WINDOWS_PREFIX:-/root/.cache/wx-3.3.3-mingw}"
|
||||
export ALKANE_WINEPREFIX="${ALKANE_WINEPREFIX:-/root/.cache/alkane-wine}"
|
||||
# shellcheck source=../scripts/windows-cross-env.sh
|
||||
. scripts/windows-cross-env.sh
|
||||
target="$ALKANE_WIN_TARGET"
|
||||
out_dir="${CARGO_TARGET_DIR:-target}"
|
||||
exe="$out_dir/$target/release/alkane-toolkit.exe"
|
||||
# The GUI crate's tests link wx and some create windows; Wine wants a display.
|
||||
headless() { xvfb-run -a -s '-screen 0 1280x850x24' "$@"; }
|
||||
|
||||
case "${1:-}" in
|
||||
toolchain)
|
||||
bash ci/ensure-build-deps.sh windows
|
||||
rustup target list --installed | grep -qx "$target" || rustup target add "$target"
|
||||
;;
|
||||
clippy)
|
||||
rustup component add clippy >/dev/null 2>&1 || true
|
||||
cargo clippy -p alkane-gui --no-deps --release --bins --target "$target" --offline -- -D warnings
|
||||
cargo clippy --workspace --exclude alkane-gui --exclude wx-rs --all-targets \
|
||||
--target "$target" --offline -- -D warnings
|
||||
;;
|
||||
build)
|
||||
cargo build --release -p alkane-gui --target "$target" --offline
|
||||
# One self-contained .exe: any toolchain DLL import would fail on a clean
|
||||
# Windows machine, so refuse to ship one.
|
||||
if x86_64-w64-mingw32-objdump -p "$exe" | grep -iE 'DLL Name: (libstdc|libgcc|libwinpthread)'; then
|
||||
echo "alkane-toolkit.exe imports a mingw runtime DLL" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
test)
|
||||
headless cargo test --workspace --exclude wx-rs --target "$target" --offline 2>&1 \
|
||||
| tee tests-windows.txt
|
||||
;;
|
||||
selftest)
|
||||
bash scripts/ui-selftest-windows.sh "$exe"
|
||||
;;
|
||||
package)
|
||||
python3 ci/package-windows.py release "${2:?usage: windows-ci.sh package VERSION}" "$exe" dist
|
||||
;;
|
||||
test-bundle)
|
||||
mkdir -p dist
|
||||
cargo test --workspace --exclude wx-rs --target "$target" --offline --no-run \
|
||||
--message-format=json > "$out_dir/windows-tests.json"
|
||||
python3 ci/package-windows.py tests "$out_dir/windows-tests.json" \
|
||||
dist/alkane-toolkit-windows-tests.zip
|
||||
;;
|
||||
*)
|
||||
sed -n '3,16p' "$0" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
+16
-1
@@ -1,8 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Key the native wxWidgets prefix to its tracked source and build toolchain.
|
||||
# Key a wxWidgets prefix to its tracked source and build toolchain.
|
||||
# wx-cache-key.sh [linux|windows]
|
||||
set -euo pipefail
|
||||
|
||||
platform="${1:-linux}"
|
||||
if [ "$platform" = windows ]; then
|
||||
material="$({
|
||||
git rev-parse HEAD:thirdparty/wxwidgets/wxWidgets-3.3.3
|
||||
git rev-parse HEAD:scripts/build-wx-windows.sh
|
||||
x86_64-w64-mingw32-g++-posix -dumpmachine
|
||||
x86_64-w64-mingw32-g++-posix -dumpfullversion
|
||||
} )"
|
||||
digest="$(printf '%s\n' "$material" | sha256sum | cut -c1-24)"
|
||||
key="wx-3.3.3-mingw-$digest"
|
||||
if [ -n "${GITHUB_OUTPUT:-}" ]; then printf 'key=%s\n' "$key" >> "$GITHUB_OUTPUT"; else printf '%s\n' "$key"; fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
material="$({
|
||||
git rev-parse HEAD:thirdparty/wxwidgets/wxWidgets-3.3.3
|
||||
git rev-parse HEAD:scripts/build-wx-linux.sh
|
||||
|
||||
Reference in New Issue
Block a user