feat: update CI workflow comments and improve clarity for Windows builds
CI / Windows x64 (push) Successful in 9m7s

This commit is contained in:
2026-08-02 18:09:20 +07:00
parent 3a2f02d480
commit 27b78ae6be
+42 -37
View File
@@ -1,3 +1,4 @@
# Windows builds run on Debian: cross-compilation plus Inno Setup under Wine.
name: CI
on:
@@ -9,31 +10,32 @@ on:
env:
TARGET: x86_64-pc-windows-msvc
# Адрес, который вшивается в программу как источник обновлений. Берётся из
# самого Gitea, так что при переезде инстанса менять ничего не нужно.
# Контекст github, а не gitea: Gitea Actions заполняет его ради
# совместимости, и он поддерживается всеми версиями.
# Update source baked into the binary. Taken from Gitea itself, so moving the
# instance needs no code change. Uses the `github` context rather than
# `gitea`: Gitea Actions fills it in for compatibility and every version
# supports it.
SYSHELPER_UPDATE_BASE: ${{ github.server_url }}
jobs:
build:
name: Windows x64
runs-on: ubuntu-latest
# Debian с node: node нужен самому Gitea Actions, чтобы запускать
# JS-действия вроде actions/checkout внутри контейнера.
# Debian with node: Gitea Actions needs node inside the container to run
# JavaScript actions such as actions/checkout.
container:
image: node:20-bookworm
steps:
- uses: actions/checkout@v4
# Windows-сборка идёт кросс-компиляцией:
# clang/lld — компилятор и компоновщик для MSVC-таргета;
# llvm — даёт llvm-lib; без него падает сборка ring, который
# компилирует свой C-код и требует архиватор (проверено);
# wine + i386 — под ним работает ISCC.exe, компилятор Inno Setup (он 32-битный);
# xvfb + xauth Wine дёргает X даже там, где окно не показывает, а
# xvfb-run без xauth не стартует вовсе (проверено).
- name: Системные зависимости
# Cross-compilation toolchain:
# clang/lld - compiler and linker for the MSVC target;
# llvm - provides llvm-lib, without which ring fails to build:
# it compiles its own C code and needs an archiver;
# wine + i386 - runs ISCC.exe, the Inno Setup compiler, which is 32-bit;
# xvfb + xauth - Wine touches X even when it shows no window, and
# xvfb-run refuses to start without xauth.
- name: System dependencies
run: |
set -eux
dpkg --add-architecture i386
@@ -43,10 +45,11 @@ jobs:
clang lld llvm \
wine wine32:i386 wine64 xvfb xauth
- name: Rust и cargo-xwin
- name: Rust and cargo-xwin
run: |
set -eux
# minimal не включает clippy — без явного компонента шаг проверки упадёт
# The minimal profile omits clippy; without the explicit component
# the lint step below fails.
curl -fsSL https://sh.rustup.rs | sh -s -- -y \
--profile minimal --component clippy --default-toolchain stable
. "$HOME/.cargo/env"
@@ -54,7 +57,7 @@ jobs:
cargo install cargo-xwin --locked
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Версия
- name: Resolve version
id: meta
run: |
set -eu
@@ -63,22 +66,23 @@ jobs:
*) version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2) ;;
esac
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "версия: $version"
echo "version: $version"
# Именно под Windows-таргетом: большая часть кода — служба и работа с
# процессами — скрыта за cfg(windows), и на линуксовой цели не проверится.
# Linted against the Windows target on purpose: most of the code - the
# service and the process handling - sits behind cfg(windows) and would
# go unchecked on a Linux target.
- name: Clippy
run: cargo xwin clippy --release --locked --target "$TARGET" -- -D warnings
- name: Сборка
- name: Build
run: cargo xwin build --release --locked --target "$TARGET"
# ISCC.exe — 32-битное приложение Windows, поэтому запускается под Wine.
# Версия закреплена: скрипту нужен минимум 6.1 (SaveStringsToUTF8File) и
# 6.3 (ArchitecturesAllowed=x64compatible). Качаем с GitHub — jrsoftware.org
# отдаёт по /download.php страницу, а не файл, а files.jrsoftware.org
# выкладывает только подписи (проверено).
- name: Inno Setup под Wine
# ISCC.exe is a 32-bit Windows application, hence Wine. The version is
# pinned: the script needs at least 6.1 (SaveStringsToUTF8File) and 6.3
# (ArchitecturesAllowed=x64compatible). Downloaded from GitHub because
# jrsoftware.org/download.php serves an HTML page rather than the file,
# and files.jrsoftware.org publishes signatures only.
- name: Install Inno Setup under Wine
env:
WINEPREFIX: /tmp/wine
WINEDEBUG: "-all"
@@ -90,7 +94,7 @@ jobs:
xvfb-run -a wine /tmp/innosetup.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
ls "$WINEPREFIX/drive_c/Program Files (x86)/Inno Setup 6/ISCC.exe"
- name: Установщик
- name: Build installer
env:
WINEPREFIX: /tmp/wine
WINEDEBUG: "-all"
@@ -103,33 +107,34 @@ jobs:
installer/setup.iss
ls -la dist
# v3, а не v4: приём артефактов v4 умеют не все версии Gitea.
# v3 rather than v4: not every Gitea version accepts v4 artifacts.
- uses: actions/upload-artifact@v3
with:
name: syshelper-${{ steps.meta.outputs.version }}-windows-x64
path: dist/*.exe
# Релиз создаём через API Gitea: он совместим с GitHub по формату, но
# готовых действий для него в самоподнятом инстансе может не оказаться.
- name: Релиз
# Releases go through the Gitea API directly: it is GitHub-compatible in
# shape, but a self-hosted instance may not have ready-made actions.
- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
# pipefail обязателен: без него провал curl потерялся бы за успешным
# jq, id стал бы null, и ассеты полетели бы в несуществующий релиз.
# Без -x: в команде участвует токен.
# pipefail is required: without it a failing curl would be masked by
# a successful jq, id would become null, and the assets would be
# uploaded to a release that does not exist.
# No -x here: the command carries the token.
set -euo pipefail
id=$(curl -fsS -X POST "$API/releases" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" | jq -r .id)
echo "релиз $TAG (id $id)"
echo "release $TAG (id $id)"
for file in dist/*.exe; do
echo "загружаю $(basename "$file")"
echo "uploading $(basename "$file")"
curl -fsS -X POST "$API/releases/$id/assets?name=$(basename "$file")" \
-H "Authorization: token $TOKEN" \
-F "attachment=@$file" > /dev/null