mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-07 08:03:30 +08:00
added option to require pcommandbatch builds to succeed
This commit is contained in:
parent
31f41586d3
commit
1ce60b594e
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
|||||||
- name: Compile binary
|
- name: Compile binary
|
||||||
run: make cmake-server-build
|
run: make cmake-server-build
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: BA_APP_RUN_ENABLE_BUILDS=1 BA_APP_RUN_BUILD_HEADLESS=1 make test
|
run: BA_PCOMMANDBATCH_REQUIRE=1 BA_APP_RUN_BUILD_HEADLESS=1 make test
|
||||||
|
|
||||||
# Test spinoff projects - versions of the project with feature-sets
|
# Test spinoff projects - versions of the project with feature-sets
|
||||||
# added or removed or other changes made.
|
# added or removed or other changes made.
|
||||||
|
|||||||
@ -95,25 +95,29 @@ def build_pcommandbatch(inpaths: list[str], outpath: str) -> None:
|
|||||||
# Make an quiet attempt to build a batch binary, but just symlink
|
# Make an quiet attempt to build a batch binary, but just symlink
|
||||||
# the plain old pcommand if anything goes wrong. That should work in
|
# the plain old pcommand if anything goes wrong. That should work in
|
||||||
# all cases; it'll just be slower.
|
# all cases; it'll just be slower.
|
||||||
try:
|
|
||||||
# TEMP - clean up old path (our dir used to be just a binary).
|
|
||||||
if os.path.isfile(os.path.dirname(outpath)):
|
|
||||||
os.remove(os.path.dirname(outpath))
|
|
||||||
|
|
||||||
|
# Options to show build output or to fail if the build fails.
|
||||||
|
verbose = os.environ.get('BA_PCOMMANDBATCH_BUILD_VERBOSE') == '1'
|
||||||
|
require = os.environ.get('BA_PCOMMANDBATCH_REQUIRE') == '1'
|
||||||
|
|
||||||
|
try:
|
||||||
if os.path.islink(outpath):
|
if os.path.islink(outpath):
|
||||||
os.unlink(outpath)
|
os.unlink(outpath)
|
||||||
|
|
||||||
os.makedirs(os.path.dirname(outpath), exist_ok=True)
|
os.makedirs(os.path.dirname(outpath), exist_ok=True)
|
||||||
|
|
||||||
# Note: this is kinda a project-specific path; perhaps we'd
|
# Let compile output show if they want verbose OR if they're
|
||||||
# want to specify this in project-config?
|
# requiring batch to succeed.
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
['cc'] + inpaths + ['-o', outpath],
|
['cc'] + inpaths + ['-o', outpath],
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=os.environ.get('BA_PCOMMANDBATCH_BUILD_VERBOSE')
|
capture_output=not (verbose or require),
|
||||||
!= '1',
|
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
|
if require:
|
||||||
|
raise CleanError('pcommandbatch build failed.') from exc
|
||||||
|
|
||||||
|
# No biggie; we'll just use regular pcommand.
|
||||||
print(
|
print(
|
||||||
f'{Clr.YLW}Warning: Unable to build pcommandbatch executable;'
|
f'{Clr.YLW}Warning: Unable to build pcommandbatch executable;'
|
||||||
f' falling back to regular pcommand. Build with env var'
|
f' falling back to regular pcommand. Build with env var'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user