From 9b8ef1bcc8b2539dbe642ec8664dbb1864e04063 Mon Sep 17 00:00:00 2001 From: chexit Date: Mon, 23 Nov 2026 23:08:04 +0300 Subject: [PATCH] CI: keep the per-push job inside the runner's disk (#102) Run 140, the first green build since 2 November, knocked Gitea's database over: from 19:42:52 UTC, right after the mod test binaries were written, the API answered 500 and 401 and ssh said 'the database system is in recovery mode' until 19:53:28, eighteen seconds after the job had ended and its workspace was gone. The tests themselves are innocent (ground_oom peaks at 113 MiB RSS); what the job leaves behind is not. rustup installed stable and then the pinned 1.99.1 on top of it (about 1.1 GB), and the debug test targets of the core and of the mod (669 MB for the mod alone) stayed on disk through the release build. The runner shares that disk with Gitea and its database; on 6 November release.yml found 1 GB free there. The job now installs only the channel pinned in rust-toolchain.toml, deletes each test target directory once its step is done, and refuses to start with less than 4 GB free, with the same ::error:: wording as release.yml, after printing df and free into the log. Both test suites stay complete. Not verified on the server (no access there). The log now shows the free space at the start, so the next run confirms or corrects the diagnosis. --- .gitea/workflows/build.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 9dad51c..c2c533b 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,6 +1,8 @@ # На каждый пуш: только мод (.hmod, один для всех ОС) и релиз build-<номер> с ним. # Раннер живёт на одной машине с Gitea и другими сервисами (2 ядра, 4 ГБ): сборка мода лёгкая — # один поток компиляции, низший приоритет, без системных пакетов и без кэша target. +# Диск у раннера тоже общий с базой Gitea: 23.11.2026, дойдя до тестов, джоба уронила базу до конца прогона. +# Поэтому один закреплённый тулчейн вместо stable поверх него и без каталогов target тестов к моменту сборки мода. # Игра-форк здесь не собирается: только по тегу версии (release.yml, Windows) и вручную (game.yml Linux, desktop.yml macOS). name: build @@ -22,9 +24,19 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + # Не начинать, когда места мало: иначе сборка займёт диск до конца, а база Gitea на нём падает. + - name: Ресурсы раннера + run: | + df -h / | tail -1 + free -m | sed -n '1,2p' + FREE=$(df --output=avail -BM / | tail -1 | tr -dc 0-9) + if [ "$FREE" -lt 4000 ]; then echo "::error::на сервере свободно ${FREE} МБ, нужно хотя бы 4000"; exit 1; fi + # Только закреплённый тулчейн из rust-toolchain.toml: stable ставился раньше и лежал мёртвым грузом. - name: Rust run: | - curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --target wasm32-unknown-unknown + CHANNEL=$(sed -n 's/^channel = "\(.*\)"$/\1/p' rust-toolchain.toml) + if [ -z "$CHANNEL" ]; then echo "::error::rust-toolchain.toml: не прочитан channel"; exit 1; fi + curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "$CHANNEL" --target wasm32-unknown-unknown echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" # Без actions/cache: кэш-сервер раннера из контейнеров задач недоступен — восстановление # падало по таймауту, а сохранение вешало «Complete job» на пару минут. Инструмент собирается заново. @@ -41,16 +53,19 @@ jobs: python3 -m unittest discover -s tools -p test_sound_catalog.py python3 tools/gen_models.py --check python3 -m unittest discover -s tools -p test_model_bounds.py + # После тестов их каталог target не нужен (модуль собирается под wasm заново), а на диске его место. - name: Тесты ядра без SDK working-directory: airdef-core run: | HOST=$(rustc -vV | sed -n 's/^host: //p') nice -n 19 cargo test --target "$HOST" + rm -rf target - name: Тесты мода working-directory: airdef-mod run: | HOST=$(rustc -vV | sed -n 's/^host: //p') nice -n 19 cargo test --target "$HOST" + rm -rf target - name: Мод run: nice -n 19 python3 tools/airdef.py mod - name: Релиз