Compare commits

...

10 Commits

Author SHA1 Message Date
JunioR
dfa030ad02 README.md: опис гри для репозиторію (UA + EN), завантаження, скриншоти, розробка й реліз
Some checks failed
build / build (push) Failing after 4m12s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZvBYf9Geq8jKdMTEwC
2026-11-25 17:30:04 +00:00
Claude
9ee82dde6a CI: перевірка exe під Wine перед публікацією (гра 20 с, тести fx/balance/update і скриншоти на релізному шаблоні; screenshots-wine.zip у релізі)
Some checks failed
build / build (push) Has been cancelled
ci-image / image (push) Successful in 5m16s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxjRNfPF6rNJTvBXnq
2026-11-25 17:08:55 +00:00
Claude
b42d24c477 README: час збірок після кешу й паралельних тестів
All checks were successful
build / build (push) Successful in 37s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxjRNfPF6rNJTvBXnq
2026-11-25 16:00:17 +00:00
Gitea Actions
90d7440756 template.sha256: rebuilt template-4.7.2 2026-11-25 15:58:49 +00:00
Claude
25bf505bab CI швидше: тести й сіди бота паралельно (тег пропускає тести, якщо коміт уже пройшов на main); шаблон і образ збираються BuildKit з кешем (тулчейн, вихідні коди, об'єкти scons)
All checks were successful
build / build (push) Successful in 35s
ci-image / image (push) Successful in 3m15s
template / template (push) Successful in 14m27s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxjRNfPF6rNJTvBXnq
2026-11-25 15:40:30 +00:00
Gitea Actions
796f4c73e3 template.sha256: rebuilt template-4.7.2
All checks were successful
build / build (push) Successful in 1m29s
2026-11-25 15:31:07 +00:00
Claude
7e64cdd18b template: winrt, accesskit, angle явно вимкнено (і так вимикались без SDK, тепер без попереджень)
All checks were successful
build / build (push) Successful in 1m6s
template / template (push) Successful in 18m22s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxjRNfPF6rNJTvBXnq
2026-11-25 15:15:47 +00:00
Gitea Actions
2ba5ac6424 template.sha256: rebuilt template-4.7.2 2026-11-25 15:11:12 +00:00
Claude
54564c5764 CI: build.yml працює в образі tinmerezhi-ci, без завантаження Godot, Go, fontTools і butler щоразу
All checks were successful
build / build (push) Successful in 1m26s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxjRNfPF6rNJTvBXnq
2026-11-25 14:54:27 +00:00
Claude
3e78f4ccef CI: власний Docker-образ tinmerezhi-ci (Godot, малий шаблон, fontTools, go-winres, butler) і workflow перезбірки шаблону на сервері
All checks were successful
build / build (push) Successful in 1m14s
ci-image / image (push) Successful in 3m53s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HrHZxjRNfPF6rNJTvBXnq
2026-11-25 14:42:27 +00:00
14 changed files with 345 additions and 44 deletions

View File

@@ -12,44 +12,62 @@ env:
jobs:
build:
runs-on: ubuntu-latest
# local image with Godot, the small template, fontTools, go-winres and butler (ci/Dockerfile, workflow ci-image.yml);
# if a job says the image is missing: Actions -> ci-image -> Run workflow
container:
image: tinmerezhi-ci:4.7.2
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # all tags and history: release notes from commits since the previous tag
- name: Godot
run: |
curl -sSL --fail -o /tmp/godot.zip "https://github.com/godotengine/godot/releases/download/${GODOT_VER}-stable/Godot_v${GODOT_VER}-stable_linux.x86_64.zip"
unzip -q -o /tmp/godot.zip -d /tmp/godot
install /tmp/godot/Godot_v${GODOT_VER}-stable_linux.x86_64 /usr/local/bin/godot
godot --version
- name: Import
working-directory: source_godot
run: godot --headless --path . --import
run: godot --version && godot --headless --path . --import
- name: Tests
run: GODOT=godot sh source_godot/run_tests.sh
- name: Balance bot (several seeds, every difficulty, both endings, endless)
- name: Tests and balance bot (in parallel; a tag skips them if this commit already passed on main)
working-directory: source_godot
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# seed:difficulty (0 novice, 1 normal, 2 paranoid):choices in the Act IV and Act V finals
fail=0
case "$GITHUB_REF" in refs/tags/*)
if curl -sf -H "Authorization: token $TOKEN" "http://gitea:3000/api/v1/repos/$GITHUB_REPOSITORY/actions/tasks?limit=50" | python3 -c '
import json, os, sys
ok = any(t["name"] == "build" and t["head_branch"] == "main" and t["head_sha"] == os.environ["GITHUB_SHA"]
and t["status"] == "success" for t in json.load(sys.stdin)["workflow_runs"])
sys.exit(0 if ok else 1)'; then
echo "commit $GITHUB_SHA already passed the tests on main: skipped"; exit 0
fi;;
esac
# every Godot process gets its own user:// (XDG_DATA_HOME), because the tests reuse save file names
L=/tmp/ci; mkdir -p $L
run() { n=$1; shift; (env XDG_DATA_HOME=$L/u_$n "$@" > $L/$n.log 2>&1; echo $? > $L/$n.rc) & }
run tests env GODOT=godot sh run_tests.sh
# balance bot: seed:difficulty (0 novice, 1 normal, 2 paranoid):choices in the Act IV and Act V finals
for c in 1:1:22 2:1:11 3:1:22 4:0:11 5:2:22 7:2:11; do
s=$(echo $c | cut -d: -f1); d=$(echo $c | cut -d: -f2); ch=$(echo $c | cut -d: -f3)
r=$(BAL_DIFF=$d BAL_CHOICE=$ch BAL_ENDLESS=1 godot --headless --path . -s tests/balance.gd -- $s 2>&1) || fail=1
echo "seed $s diff $d choice $ch: $(echo "$r" | grep -E '^(НЕСКІНЧЕННА|КІНЕЦЬ|OK|FAIL)' | tr '\n' ' ')"
run "bal_$s" env BAL_DIFF=$d BAL_CHOICE=$ch BAL_ENDLESS=1 godot --headless --path . -s tests/balance.gd -- $s
done
wait
cat $L/tests.log
fail=0
for c in 1:1:22 2:1:11 3:1:22 4:0:11 5:2:22 7:2:11; do
s=${c%%:*}
echo "seed $c: $(grep -E '^(НЕСКІНЧЕННА|КІНЕЦЬ|OK|FAIL)' $L/bal_$s.log | tr '\n' ' ')"
done
for r in $L/*.rc; do [ "$(cat $r)" = 0 ] || { fail=1; echo "FAILED: $(basename $r .rc)"; cat ${r%.rc}.log | tail -30; }; done
exit $fail
- name: Export Windows exe
if: startsWith(github.ref, 'refs/tags/')
working-directory: source_godot
run: |
# small template without 3D/physics (tools/build_template.sh), kept in the prerelease template-<ver>;
# if it is missing or its checksum differs, fall back to the official 109 MB one
if curl -sSL --fail -o tools/template.exe "http://gitea:3000/${{ github.repository }}/releases/download/template-${GODOT_VER}/TinMerezhi-template.exe" \
# small template without 3D/physics (tools/build_template.sh): from the CI image, else from the prerelease
# template-<ver>; if both are missing or their checksum differs, fall back to the official 109 MB one
cp /opt/tinmerezhi/template.exe tools/template.exe 2>/dev/null || true
if echo "$(cat tools/template.sha256) tools/template.exe" | sha256sum -c - 2>/dev/null; then
echo "small template from the CI image: $(stat -c %s tools/template.exe) bytes"
elif curl -sSL --fail -o tools/template.exe "http://gitea:3000/${{ github.repository }}/releases/download/template-${GODOT_VER}/TinMerezhi-template.exe" \
&& echo "$(cat tools/template.sha256) tools/template.exe" | sha256sum -c -; then
echo "small template: $(stat -c %s tools/template.exe) bytes"
else
@@ -57,20 +75,11 @@ jobs:
python3 tools/fetch_template.py
cp ~/.local/share/godot/export_templates/${GODOT_VER}.stable/windows_release_x86_64.exe tools/template.exe
fi
# emoji font: keep only the characters the game uses (10.6 MB -> ~0.2 MB); without fontTools the full font stays
python3 -c 'import fontTools' 2>/dev/null || python3 -m pip install -q --break-system-packages fonttools \
|| (apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq python3-fonttools >/dev/null) || true
if python3 -c 'import fontTools'; then
python3 tools/subset_emoji.py fonts/NotoColorEmoji.ttf /tmp/emoji.ttf && mv /tmp/emoji.ttf fonts/NotoColorEmoji.ttf
godot --headless --path . --import
else
echo "::warning::fontTools not installed, emoji font not reduced"
fi
# emoji font: keep only the characters the game uses (10.6 MB -> ~0.2 MB), fontTools is in the CI image
python3 tools/subset_emoji.py fonts/NotoColorEmoji.ttf /tmp/emoji.ttf && mv /tmp/emoji.ttf fonts/NotoColorEmoji.ttf
godot --headless --path . --import
cp icon.ico tools/
# official Go toolchain from the Go module proxy, only to build go-winres (puts the icon into the exe)
curl -sSL --fail -o /tmp/go.zip "https://proxy.golang.org/golang.org/toolchain/@v/v0.0.1-go1.24.7.linux-amd64.zip"
unzip -q -o /tmp/go.zip -d /tmp/go
GOBIN=/usr/local/bin /tmp/go/golang.org/toolchain@v0.0.1-go1.24.7.linux-amd64/bin/go install github.com/tc-hib/go-winres@v0.3.3
# go-winres (from the CI image) puts the icon into the exe
(cd tools && go-winres patch --in winres.json --no-backup template.exe)
sed -i "s|^custom_template/release=.*|custom_template/release=\"$PWD/tools/template.exe\"|" export_presets.cfg
# version for the in-game updater: tag v1.0.4 -> 1.0.4
@@ -79,6 +88,13 @@ jobs:
godot --headless --path . --export-release "Windows Desktop" ../game_godot/TinMerezhi.exe
ls -l ../game_godot/TinMerezhi.exe
- name: Windows exe under Wine (the game, tests and screenshots on the real template)
if: startsWith(github.ref, 'refs/tags/')
working-directory: source_godot
run: |
TEMPLATE=tools/template.exe sh ../ci/wine_check.sh ../game_godot/TinMerezhi.exe /tmp/shots
python3 -c 'import shutil; shutil.make_archive("/tmp/screenshots-wine", "zip", "/tmp/shots")'
- name: Upload to Release
if: startsWith(github.ref, 'refs/tags/')
env:
@@ -96,6 +112,8 @@ jobs:
ID=$(curl -sf -H "$H" "$API/releases/tags/$TAG" | getid) || \
ID=$(curl -sf -H "$H" -H "Content-Type: application/json" -d "$BODY" "$API/releases" | getid)
curl -sSf -H "$H" -F "attachment=@game_godot/TinMerezhi.exe" "$API/releases/$ID/assets?name=TinMerezhi.exe" >/dev/null
# screenshots taken by the real exe under Wine (the in-game updater only looks for TinMerezhi.exe)
curl -sSf -H "$H" -F "attachment=@/tmp/screenshots-wine.zip" "$API/releases/$ID/assets?name=screenshots-wine.zip" >/dev/null
echo "Release $TAG: TinMerezhi.exe uploaded"
- name: Publish to itch.io
@@ -107,6 +125,4 @@ jobs:
TAG: ${{ github.ref_name }}
run: |
if [ -z "$BUTLER_API_KEY" ] || [ -z "$ITCH_TARGET" ]; then echo "itch.io: no BUTLER_API_KEY / ITCH_TARGET, skipped"; exit 0; fi
curl -sSL --fail -o /tmp/butler.zip https://broth.itch.zone/butler/linux-amd64/15.32.0/archive/default
unzip -q -o /tmp/butler.zip -d /tmp/butler && chmod +x /tmp/butler/butler
/tmp/butler/butler push game_godot "$ITCH_TARGET:windows" --userversion "${TAG#v}"
butler push game_godot "$ITCH_TARGET:windows" --userversion "${TAG#v}"

View File

@@ -0,0 +1,15 @@
# Rebuilds the local CI image tinmerezhi-ci:4.7.2 that build.yml runs in.
# Runs by hand (Actions -> ci-image -> Run workflow) or when the image recipe or the template checksum changes.
name: ci-image
on:
push:
branches: [main]
paths: ['ci/**', 'source_godot/tools/template.sha256', '.gitea/workflows/ci-image.yml']
workflow_dispatch:
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sh ci/build_image.sh

View File

@@ -0,0 +1,54 @@
# Rebuilds the small Windows export template (tools/template_custom.py) from Godot sources on the server,
# replaces TinMerezhi-template.exe in the prerelease template-<ver>, commits the new tools/template.sha256
# and rebuilds the CI image. First build ~15 min on 8 cores, a profile change rebuilds only what it touches,
# an unchanged profile ~1 min (Docker cache). Up to ~8 GB RAM (lto=full), ~6 GB disk in the Docker build cache.
name: template
on:
push:
branches: [main]
paths: ['source_godot/tools/template_custom.py', 'source_godot/tools/build_template.sh']
workflow_dispatch:
env:
GODOT_VER: "4.7.2"
jobs:
template:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build template (Docker, cached toolchain and objects)
run: |
. ci/docker_cli.sh
time docker buildx build --build-arg GODOT_VER=$GODOT_VER -f ci/template.Dockerfile --output type=local,dest=/tmp/tpl source_godot/tools
ls -l /tmp/tpl/template.exe
- name: Upload to the prerelease, commit the checksum
env:
TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
API: http://gitea:3000/api/v1/repos/${{ github.repository }}
run: |
EXE=/tmp/tpl/template.exe
TAG=template-$GODOT_VER
H="Authorization: token $TOKEN"
getid() { python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])'; }
ID=$(curl -sf -H "$H" "$API/releases/tags/$TAG" | getid) || \
ID=$(curl -sf -H "$H" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"prerelease\":true,\"body\":\"Small Windows export template (tools/template_custom.py)\"}" "$API/releases" | getid)
# replace the old asset
for a in $(curl -sf -H "$H" "$API/releases/$ID/assets" | python3 -c 'import json,sys; [print(a["id"]) for a in json.load(sys.stdin) if a["name"]=="TinMerezhi-template.exe"]'); do
curl -sSf -X DELETE -H "$H" "$API/releases/$ID/assets/$a"
done
curl -sSf -H "$H" -F "attachment=@$EXE" "$API/releases/$ID/assets?name=TinMerezhi-template.exe" >/dev/null
sha256sum "$EXE" | cut -d' ' -f1 > source_godot/tools/template.sha256
echo "template: $(stat -c %s "$EXE") bytes, sha256 $(cat source_godot/tools/template.sha256)"
git config user.name "Gitea Actions"; git config user.email "actions@localhost"
if ! git diff --quiet source_godot/tools/template.sha256; then
git commit -qm "template.sha256: rebuilt template-$GODOT_VER" source_godot/tools/template.sha256
git pull -q --rebase "http://x:$TOKEN@gitea:3000/${{ github.repository }}.git" main
git push -q "http://x:$TOKEN@gitea:3000/${{ github.repository }}.git" HEAD:main
fi
- name: Rebuild the CI image with the new template
run: sh ci/build_image.sh

1
.gitignore vendored
View File

@@ -18,3 +18,4 @@ cleanup/
# Windows junk
Thumbs.db
desktop.ini
ci/template.exe

91
README.md Normal file
View File

@@ -0,0 +1,91 @@
# Тінь Мережі · Shadow Net
![Тінь Мережі](itch/screenshots/1_start.png)
**Тінь Мережі** — хакерська гра, де все робиш у терміналі. *[English version below](#shadow-net).*
Ти — Shadow, хакер-одинак. Таємничий Оракул дає завдання: від Wi-Fi кав'ярні до орбітального ядра системи стеження "Аргус". А за всім, від банку до супутника, стоїть один ворог — Пуйло. Скануй мережу, підбирай коди, відкривай порти, будуй маршрут через зламані сервери й стирай логи, бо трасування росте з кожною помилкою.
- **5 актів, 42 глави** і кілька кінцівок, що залежать від твоїх виборів
- **42 сервери** на анімованій мапі мережі: шари шифрування, закриті порти, активне трасування
- **Міні-ігри зламу**: обхід фаєрвола (логічна головоломка) і словникова атака (підбір пароля)
- **Суперники-хакери** Cobra, Mantis і Nyx: перегони за замовлення, крадіжки й помста
- **Нескінченна мережа** після фіналу: замовлення Брокера, зростаюча глибина і таблиця рекордів
- **Три складності**: Новачок, Звичайний і Параноя (жорстке трасування, без збережень)
- навички, обладнання, хакерське ПЗ, скриптові агенти, контракти й побічні замовлення
- **Звук**: процедурна синтвейв-музика, сирена тривоги, клацання клавіш, голоси персонажів
- автодоповнення команд через Tab, історія команд, `help <команда>`
- налаштування гучності, CRT-ефекту, глітчу, шрифту, повний екран (F11)
- **Українська та англійська** мови (перемикаються в налаштуваннях або командою `lang`)
- **Автооновлення**: гра сама повідомить про нову версію, команда `update` встановить її
Windows 10/11, без встановлення: завантаж і запусти `TinMerezhi.exe`.
Збереження: `%APPDATA%\Godot\app_userdata\Тінь Мережі`.
## Завантажити
- **itch.io:** https://tuberon.itch.io/tinmerezhi
- **Releases у Gitea:** https://serv.tail9357bc.ts.net/junior/TinMerezhi/releases/latest (файл `TinMerezhi.exe`)
Встановлювати нічого не треба. Windows може показати "Windows захистив ваш ПК": "Докладніше" → "Виконати все одно" (exe не має цифрового підпису). Нові версії гра знаходить сама, команда `update` їх встановлює.
## Скриншоти
| | |
|---|---|
| ![Злам](itch/screenshots/2_crack.png) | ![Акт V](itch/screenshots/6_act5.png) |
| ![Фаєрвол](itch/screenshots/8_firewall_uk.png) | ![Суперники](itch/screenshots/10_rivals_uk.png) |
## Що в репозиторії
| Шлях | Що це |
|---|---|
| `source_godot/` | проєкт Godot 4.7.2: код гри, тести, інструменти збірки ([README](source_godot/README.md)) |
| `game_godot/ПРОЧИТАЙ.txt` | інструкція гравця: усі команди й механіки |
| `ci/` | Docker-образ CI (`tinmerezhi-ci`), власний малий шаблон Windows, перевірка exe під Wine |
| `.gitea/workflows/` | `build.yml` (тести, збірка, реліз, itch.io), `template.yml`, `ci-image.yml` |
| `itch/` | обкладинка, скриншоти й текст сторінки itch.io |
## Розробка
Відкрий `source_godot/project.godot` у Godot 4.7.2. Тести: `source_godot/run_tests.bat` (Windows) або `run_tests.sh`.
Числа балансу — у `tuning.gd`, тексти й дані — у `data.gd`, `act4.gd`, `act5.gd`, `extra.gd`.
**Реліз:** кожен push у `main` запускає тести й бота балансу. Тег `v*` ще й збирає `TinMerezhi.exe`,
перевіряє його під Wine, публікує в Releases (нотатки з комітів) і на itch.io.
Деталі збірки й CI — у [source_godot/README.md](source_godot/README.md).
## Ліцензія
Гра і код — © 2026 JunioR, [MIT](LICENSE.txt). Рушій Godot — MIT. Шрифт Noto Color Emoji (Google) — SIL OFL 1.1 ([LICENSE-NotoEmoji.txt](LICENSE-NotoEmoji.txt)).
---
## Shadow Net
![Shadow Net](itch/screenshots/11_endless_en.png)
**Shadow Net** (Тінь Мережі) is a hacking game played entirely in a terminal. *The game is in Ukrainian and English.*
You are Shadow, a lone hacker. The mysterious Oracle sends you jobs, from a café's Wi-Fi all the way to the orbital core of the "Argus" surveillance system. And behind all of it, from the bank to the satellite, stands one enemy: Puilo. Scan the network, crack codes, open ports, route through hacked servers and wipe your logs, because every mistake raises the trace.
- **5 acts, 42 chapters** and several endings shaped by your choices
- **42 servers** on an animated network map: encryption layers, closed ports, active tracing
- **Hacking mini-games**: firewall bypass (a logic puzzle) and a dictionary attack (password guessing)
- **Rival hackers** Cobra, Mantis and Nyx race you for jobs, steal from you and take revenge
- **Endless Network** after the finale: Broker's jobs, growing depth and a high-score table
- **Three difficulties**: Novice, Normal and Paranoid (harsh tracing, no saves)
- skills, hardware, hacking software, script agents, contracts and side jobs
- **Sound**: procedural synthwave music, alarm siren, key clicks, character voices
- Tab completion, command history, `help <command>`
- settings for volume, CRT effect, glitch, font size, fullscreen (F11)
- **English and Ukrainian** (switch in Settings or with the `lang` command)
- **Auto-update**: the game tells you when a new version is out, and `update` installs it
Windows 10/11, no install: download and run `TinMerezhi.exe`.
**Download:** [itch.io](https://tuberon.itch.io/tinmerezhi) or [Gitea Releases](https://serv.tail9357bc.ts.net/junior/TinMerezhi/releases/latest). Windows 10/11, no install: run `TinMerezhi.exe`. Windows SmartScreen may warn you: "More info" → "Run anyway" (the exe is unsigned).
**Development:** open `source_godot/project.godot` in Godot 4.7.2 and run `run_tests.bat` / `run_tests.sh`. Every push to `main` runs the tests and the balance bot; a `v*` tag builds the exe, checks it under Wine and publishes it to Releases and itch.io. Build details: [source_godot/README.md](source_godot/README.md) (Ukrainian).
**License:** © 2026 JunioR, [MIT](LICENSE.txt). Godot engine (MIT), Noto Color Emoji (SIL OFL 1.1).

20
ci/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
# CI image for build.yml: Godot headless, the small Windows template, fontTools, go-winres, butler,
# Wine + Xvfb + Mesa (software OpenGL) to run the built exe (ci/wine_check.sh).
# Built on the server by ci/build_image.sh (workflow ci-image.yml) as the local image tinmerezhi-ci:4.7.2.
FROM node:20-bookworm
ARG GODOT_VER=4.7.2
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends python3-fonttools \
wine64 wine xvfb xauth libgl1-mesa-dri \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sSL --fail -o /tmp/g.zip "https://github.com/godotengine/godot/releases/download/${GODOT_VER}-stable/Godot_v${GODOT_VER}-stable_linux.x86_64.zip" \
&& unzip -q /tmp/g.zip -d /tmp/g && install /tmp/g/Godot_v${GODOT_VER}-stable_linux.x86_64 /usr/local/bin/godot && rm -rf /tmp/g /tmp/g.zip
# go-winres puts the icon into the exe; the Go toolchain is only needed to build it
RUN curl -sSL --fail -o /tmp/go.zip "https://proxy.golang.org/golang.org/toolchain/@v/v0.0.1-go1.24.7.linux-amd64.zip" \
&& unzip -q /tmp/go.zip -d /tmp/go \
&& GOBIN=/usr/local/bin GOPATH=/tmp/gopath GOCACHE=/tmp/gocache /tmp/go/golang.org/toolchain@v0.0.1-go1.24.7.linux-amd64/bin/go install github.com/tc-hib/go-winres@v0.3.3 \
&& rm -rf /tmp/go /tmp/go.zip /tmp/gopath /tmp/gocache
RUN curl -sSL --fail -o /tmp/b.zip https://broth.itch.zone/butler/linux-amd64/15.32.0/archive/default \
&& unzip -q /tmp/b.zip -d /opt/butler && chmod +x /opt/butler/butler && ln -s /opt/butler/butler /usr/local/bin/butler && rm /tmp/b.zip
# the small template from the prerelease template-<ver> (build_image.sh downloads it next to this file)
COPY template.exe /opt/tinmerezhi/template.exe
RUN godot --version && go-winres --help >/dev/null && butler -V && python3 -c 'import fontTools' && wine --version

13
ci/build_image.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
# Builds the local CI image tinmerezhi-ci:<ver> through the host Docker (the runner mounts /var/run/docker.sock into jobs).
# Run from the repo root inside a Gitea Actions job (needs http://gitea:3000).
set -e
VER="${GODOT_VER:-4.7.2}"
REPO="${GITHUB_REPOSITORY:-junior/TinMerezhi}"
. ci/docker_cli.sh
curl -sSL --fail -o ci/template.exe "http://gitea:3000/$REPO/releases/download/template-$VER/TinMerezhi-template.exe"
echo "$(cat source_godot/tools/template.sha256) ci/template.exe" | sha256sum -c -
docker buildx build --build-arg GODOT_VER="$VER" -t "tinmerezhi-ci:$VER" ci
rm -f ci/template.exe
docker image prune -f >/dev/null # drop the previous untagged image; build cache stays for the next run
docker images tinmerezhi-ci

12
ci/docker_cli.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
# Docker CLI + buildx (BuildKit: layer cache and cache mounts) for jobs; the daemon is the host one via /var/run/docker.sock.
set -e
command -v docker >/dev/null || {
curl -sSL --fail -o /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-27.5.1.tgz
tar xzf /tmp/docker.tgz -C /tmp && install /tmp/docker/docker /usr/local/bin/docker
}
docker buildx version >/dev/null 2>&1 || {
mkdir -p ~/.docker/cli-plugins
curl -sSL --fail -o ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.19.3/buildx-v0.19.3.linux-amd64
chmod +x ~/.docker/cli-plugins/docker-buildx
}

16
ci/template.Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
# Small Windows export template (source_godot/tools/template_custom.py), built by template.yml:
# docker buildx build -f ci/template.Dockerfile --output type=local,dest=out source_godot/tools
# The toolchain is a cached layer; the Godot sources and scons objects live in a BuildKit cache mount,
# so a rebuild only recompiles what the new profile changes.
FROM debian:bookworm-slim AS build
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \
scons mingw-w64 python3 curl ca-certificates xz-utils >/dev/null \
&& update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix \
&& update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
ARG GODOT_VER=4.7.2
COPY template_custom.py build_template.sh /tools/
RUN --mount=type=cache,target=/work cd /work && GODOT_VER=$GODOT_VER sh /tools/build_template.sh \
&& mkdir /out && cp godot-$GODOT_VER-stable/bin/godot.windows.template_release.x86_64.exe /out/template.exe
FROM scratch
COPY --from=build /out/template.exe /

44
ci/wine_check.sh Normal file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
# Runs the built Windows exe under Wine (virtual X display, software OpenGL): the game itself, then tests and
# screenshots on the same release template. Usage, from source_godot/ after the export:
# sh ../ci/wine_check.sh <exe> <screenshots dir>
# smoke/features/lang are not run here: they use RegEx, which the small template does not have (the game does not use it).
set -e
EXE=$(realpath "$1"); SHOTS=$(realpath -m "$2"); W=/tmp/wine_check
rm -rf $W && mkdir -p $W "$SHOTS"
# no Mono/Gecko installers, no crash debugger (it waits forever); a Wine virtual desktop instead of bare Xvfb windows
export WINEPREFIX=$W/prefix WINEDEBUG=-all WINEDLLOVERRIDES="mscoree,mshtml=;winedbg.exe=d"
run() { xvfb-run -a -s "-screen 0 1280x800x24" timeout "$1" wine explorer /desktop=ci,1280x720 "$2" -- "Z:$SHOTS"; }
xvfb-run -a wineboot -i >/dev/null 2>&1 || true
fail=0
echo "=== the game: starts and runs 20 s without crashing or script errors"
run 20 "$EXE" > $W/game.log 2>&1 || true
grep -vE "^ALSA|X connection|^$" $W/game.log | tail -12
if grep -qE "SCRIPT ERROR|Parse Error|Failed to load|Unhandled|X Error" $W/game.log; then echo "FAIL: errors or a crash in the game log"; fail=1; fi
# release builds ignore --main-pack and -s, so every test gets its own pack whose main loop is the test script,
# run by a copy of the same template: t_<name>.exe loads t_<name>.pck next to it
for t in fx balance update shot; do
rm -rf $W/proj && cp -r . $W/proj && cd $W/proj
sed -i 's|^exclude_filter=.*|exclude_filter=""|' export_presets.cfg
sed -i '1a class_name WineTest' tests/$t.gd
# Wine loses the exit code (and may crash after quit), so the test prints it before quitting
sed -i 's/\bquit(/_wq(/g' tests/$t.gd
printf '\nfunc _wq(c: int = 0) -> void:\n\tprint("WINE_EXIT ", c)\n\tquit(c)\n' >> tests/$t.gd
# a release build needs a main scene: an empty one, the test adds the game itself
printf '[gd_scene format=3]\n\n[node name="Empty" type="Node"]\n' > tests/empty.tscn
sed -i 's|^run/main_scene=.*|run/main_scene="res://tests/empty.tscn"|' project.godot
sed -i 's|^\[application\]|[application]\n\nrun/main_loop_type="WineTest"|' project.godot
godot --headless --path . --import >/dev/null 2>&1
godot --headless --path . --export-pack "Windows Desktop" $W/t_$t.pck >/dev/null 2>&1
cd - >/dev/null
cp "${TEMPLATE:-tools/template.exe}" $W/t_$t.exe
echo "=== $t ($(stat -c %s $W/t_$t.pck) bytes pack)"
run 300 $W/t_$t.exe > $W/$t.log 2>&1 || true
grep -vE "^ALSA|X connection|^Godot Engine|^$|audio|WASAPI|SDR white|^ at:" $W/$t.log | tail -8
grep -q "^WINE_EXIT 0" $W/$t.log || { echo "FAIL: $t"; fail=1; }
done
ls "$SHOTS"
[ "$(ls "$SHOTS" | wc -l)" -ge 8 ] || { echo "FAIL: not all screenshots"; fail=1; }
exit $fail

View File

@@ -69,8 +69,11 @@
**Малий exe (~35 МБ замість ~120 МБ).** CI бере власний шаблон без 3D, фізики, навігації, XR і зайвих модулів
(`tools/template_custom.py`) з пререлізу `template-4.7.2` у Gitea і звіряє `tools/template.sha256`; шрифт емодзі
урізається до символів, що є в коді (`tools/subset_emoji.py`, потрібен `pip install fonttools`). Новий шаблон
(інша версія Godot або інші модулі): `tools/build_template.sh` (~20–40 хв, mingw-w64 + scons), викласти exe в
пререліз `template-<версія>` як `TinMerezhi-template.exe` і оновити `tools/template.sha256`. Пререліз не бачить
(інша версія Godot або інші модулі) збирає на сервері workflow `template.yml`: сам, коли змінюється
`tools/template_custom.py`, або вручну (Actions → template → Run workflow). Він кладе exe в пререліз
`template-<версія>` як `TinMerezhi-template.exe`, комітить новий `tools/template.sha256` і перезбирає CI-образ
(перший раз ~15 хв, без змін профілю ~20 с; кеш Docker зберігає тулчейн, вихідні коди й об'єкти scons, тож зміна профілю перезбирає
лише зачеплене; до ~8 ГБ RAM, ~6 ГБ диска). Пререліз не бачить
автооновлення гри (`/releases/latest` віддає лише звичайні релізи). Нові класи рушія в коді: перевір, що їх не вимкнено.
## Реліз
@@ -78,4 +81,13 @@
Кожен push у `main` — тести й бот балансу в Gitea Actions (`.gitea/workflows/build.yml`).
Тег `v*` (`git tag v1.0.17 && git push origin v1.0.17`) — ще й збірка `TinMerezhi.exe` у Releases
з нотатками зі списку комітів після попереднього тегу, і публікація на itch.io через butler.
Збірка йде в локальному Docker-образі `tinmerezhi-ci:4.7.2` (`ci/Dockerfile`: Godot, малий шаблон, fontTools,
go-winres, butler), тож нічого не завантажується щоразу. Образ перезбирає workflow `ci-image.yml`
(сам при зміні `ci/` або `tools/template.sha256`, або вручну); якщо збірка каже, що образу немає, запусти його.
Тести й шість сідів бота балансу йдуть паралельно (~35 с на push). Тег не повторює тести, якщо цей самий коміт
уже пройшов їх на `main`.
Перед публікацією тег запускає зібраний exe під Wine (`ci/wine_check.sh`, Xvfb і програмний OpenGL): гра має
працювати 20 с без помилок, тести fx, balance, update і скриншоти (`tests/shot.gd`) проходять на тому самому
релізному шаблоні. Скриншоти додаються до релізу як `screenshots-wine.zip`. Якщо перевірка падає, реліз не публікується.
smoke, features і lang тут не запускаються: вони використовують RegEx, якого немає в малому шаблоні.
Гра бачить новий реліз сама (`updater.gd`).

View File

@@ -1,13 +1,16 @@
#!/bin/sh
# Builds the small Windows export template (tools/template_custom.py) from Godot sources.
# Needs: python3 + scons, mingw-w64 (posix threads). About 40 min on 4 cores, ~6 GB RAM, ~5 GB disk.
# Result: godot-<ver>-stable/bin/godot.windows.template_release.x86_64.exe -> upload it to the Gitea
# prerelease "template-<ver>" as TinMerezhi-template.exe and put its sha256 into tools/template.sha256.
# Needs: python3 + scons, mingw-w64 (posix threads). ~13 min on 8 cores (first build), ~8 GB RAM, ~5 GB disk.
# Run again in the same folder: the sources are kept and scons rebuilds only what changed.
# Result: godot-<ver>-stable/bin/godot.windows.template_release.x86_64.exe. On the server this is done by
# the workflow template.yml (ci/template.Dockerfile), which also uploads it and updates tools/template.sha256.
set -e
VER="${GODOT_VER:-4.7.2}"
HERE="$(cd "$(dirname "$0")" && pwd)"
curl -sSL --fail -o "godot-$VER.tar.xz" "https://github.com/godotengine/godot/releases/download/$VER-stable/godot-$VER-stable.tar.xz"
tar xf "godot-$VER.tar.xz"
if [ ! -f "godot-$VER-stable/SConstruct" ]; then
curl -sSL --fail -o "godot-$VER.tar.xz" "https://github.com/godotengine/godot/releases/download/$VER-stable/godot-$VER-stable.tar.xz"
tar xf "godot-$VER.tar.xz" && rm "godot-$VER.tar.xz"
fi
cd "godot-$VER-stable"
scons profile="$HERE/template_custom.py" d3d12=no vulkan=no -j"$(nproc)"
scons profile="$HERE/template_custom.py" d3d12=no vulkan=no winrt=no accesskit=no angle=no -j"$(nproc)"
sha256sum bin/godot.windows.template_release.x86_64.exe

View File

@@ -1 +1 @@
84715e06d937dd9b7e84838fa4ef8f4619e0d4f97b7887c72385189db26f67bb
5a3eda63d88b32bd07e6139103232403318ff5c0a8dadc04ea1a8d51bbe7550e

View File

@@ -16,6 +16,10 @@ disable_xr = "yes"
vulkan = "no"
d3d12 = "no"
openxr = "no"
# drivers whose SDKs are not in the source tarball: scons switches them off anyway, this only silences the warnings
winrt = "no"
accesskit = "no"
angle = "no"
modules_enabled_by_default = "no"
# GDScript, fonts (FreeType + HarfBuzz shaping), SVG for the default theme icons, mbedTLS for HTTPS in the updater
module_gdscript_enabled = "yes"