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