feat: add windows runner CI and release jobs
Some checks are pending
CI / linux (push) Waiting to run
CI / macos (push) Successful in 43s
CI / windows (push) Successful in 9m5s

This commit is contained in:
randogoth 2026-10-09 07:04:47 +03:00
parent e2795cfef9
commit 4360e45233
4 changed files with 131 additions and 26 deletions

View file

@ -66,3 +66,30 @@ jobs:
working-directory: carrier
env:
GITHUB_TOKEN: ""
windows:
runs-on: windows-x86_64
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
with:
path: carrier
- uses: https://code.forgejo.org/actions/checkout@v4
with:
repository: randogoth/fumi
ref: main
path: fumi
- uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
~/.cargo/registry
carrier/target
fumi/target
key: cargo-windows-${{ hashFiles('carrier/Cargo.lock') }}
restore-keys: cargo-windows-
# No devbox on Windows: the runner host itself is the MSYS2 MINGW64
# toolchain that windows/setup.sh installs, so this runs the same
# commands devbox's `check` script runs on the other two platforms
# straight from cargo.
- run: cargo fmt --check && cargo build && cargo test
working-directory: carrier
shell: bash

View file

@ -73,6 +73,69 @@ jobs:
"$FORGEJO/api/v1/repos/$REPO/releases/$release_id/assets?name=$NAME"
working-directory: carrier
# Same non-gating strategy as the macos job above: this runner is a
# desktop machine that isn't guaranteed to be on when a tag is pushed,
# so it must never gate the release (and must not be gated by it
# either). It builds and bundles via windows/bundle.sh - the same
# script windows/setup.sh runs for local one-command builds - then
# appends the zip to the release the linux+flatpak jobs create, with
# the same poll-for-the-release the macos job does.
windows:
runs-on: windows-x86_64
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
with:
path: carrier
- uses: https://code.forgejo.org/actions/checkout@v4
with:
repository: randogoth/fumi
ref: main
path: fumi
- uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
~/.cargo/registry
carrier/target
fumi/target
key: cargo-windows-${{ hashFiles('carrier/Cargo.lock') }}
restore-keys: cargo-windows-
- run: bash windows/bundle.sh
working-directory: carrier
shell: bash
- run: |
REPO="${{ forge.repository }}"
TAG="${{ forge.ref_name }}"
FORGEJO="${{ env.FORGEJO_SERVER_URL }}"
FORGEJO="${FORGEJO%%/}"
TOKEN="${{ forge.token }}"
VERSION=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1)
FILE="carrier-windows-$VERSION.zip"
NAME="carrier-windows-$VERSION.zip"
release_id=""
for i in $(seq 1 40); do
body=$(curl --retry 5 -sS -H "Authorization: token $TOKEN" "$FORGEJO/api/v1/repos/$REPO/releases/tags/$TAG")
release_id=$(echo "$body" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
if [ -n "$release_id" ]; then
break
fi
echo "release for $TAG not ready yet, waiting 15s ($i/40)"
sleep 15
done
if [ -z "$release_id" ]; then
echo "release for $TAG never appeared after 10 minutes" >&2
exit 1
fi
curl --retry 5 --fail -sS -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@$FILE" \
"$FORGEJO/api/v1/repos/$REPO/releases/$release_id/assets?name=$NAME"
working-directory: carrier
shell: bash
linux:
runs-on: linux-x86_64
steps: