fix(configure-resources): handle Windows (Git Bash) host detection#8
Merged
Merged
Conversation
CI job "Testy Makefile (Windows)" failed on every push to main since the resource-limits redesign (PR #5) added a test that runs scripts/configure-resources.sh on windows-latest. The script's host detection only matched `Linux`/`Darwin` from `uname -s`; on Git Bash `uname -s` is `MINGW64_NT-...`, hitting the `*)` branch -> `exit 1`, so the test reported "configure-resources zwrocil blad" (65 passed, 1 failed). Add a `MINGW*|MSYS*|CYGWIN*` branch: read RAM from /proc/meminfo (emulated by the MSYS runtime) and CPU from nproc, with graceful fallbacks (NUMBER_OF_PROCESSORS, then 1) so it never exits non-zero. If RAM can't be read, TOTAL_RAM_GB=0 and the existing budget floor (4 GB) takes over - fixed caps are host-independent so the .env still gets correct values. BPP deploys on Linux; Windows is a dev-only environment, so finishing and writing .env is all that's needed there. Verified: worst case (uname stubbed to MINGW64, no /proc/meminfo) exits 0 and produces all values the CI test asserts; macOS native path unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The CI job
Testy Makefile (Windows)has failed on every push tomainsince the resource-limits redesign (#5), which added a test that runsscripts/configure-resources.shonwindows-latest.mainhas been red since 2026-06-01 (visible on the #5 and #7 merge runs alike —65 passed, 1 failed).Root cause: the script's host detection only matched
Linux/Darwinfromuname -s. On Git Bashuname -sisMINGW64_NT-..., which falls through to the*)branch →exit 1:Unrelated to the media-root change in #7 — that PR just inherited the pre-existing red.
Fix
Add a
MINGW*|MSYS*|CYGWIN*branch to theuname -scase:/proc/meminfo(emulated by the MSYS runtime on Git Bash), CPU fromnproc.NUMBER_OF_PROCESSORS→1; RAM unreadable →TOTAL_RAM_GB=0, and the existing 4 GB budget floor takes over..envstill gets correct values even in the worst case.BPP deploys on Linux; Windows is a dev-only environment, so finishing and writing
.envis all that's required there.Verification
unamestubbed toMINGW64, no/proc/meminfo,NUMBER_OF_PROCESSORS=4): script exits 0 and produces every value the CI test asserts —REDIS_MEM_LIMIT=1024m,…=192m/128m/320m/64m,REDIS_MAXMEMORY=819mb, presence ofAPPSERVER/DBSERVER/WORKER_GENERAL_MEM_LIMIT+DBSERVER_CPU_LIMIT, and absence ofFLOWER_CPU_LIMIT.64 GB / 16 CPUdetected, fixed caps correct).bash -nclean; pre-commit incl. shellcheck green.🤖 Generated with Claude Code