refactor(build): 统一本地与 CI 构建入口及平台发布工具 (#9)
Gitea CI / Check code and tests (push) Successful in 7m38s
Gitea CI / Build Android APK (push) Successful in 6m20s
Gitea CI / Audit and package Windows x64 (push) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (push) Canceled after 0s
Gitea CI / Gitea CI passed (push) Canceled after 0s
Gitea CI / Build Windows x64 app (push) Canceled after 14m42s
Gitea CI / Check code and tests (push) Successful in 7m38s
Gitea CI / Build Android APK (push) Successful in 6m20s
Gitea CI / Audit and package Windows x64 (push) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (push) Canceled after 0s
Gitea CI / Gitea CI passed (push) Canceled after 0s
Gitea CI / Build Windows x64 app (push) Canceled after 14m42s
This commit was merged in pull request #9.
This commit is contained in:
1 parent
a13a54d5ec
commit
4a759d81a6
61 files changed
+1913
-388
No files matched your search
@@ -0,0 +1,31 @@
|
||||
"""Run argument vectors and report failures without logging credentials."""
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def run(command, *, cwd=ROOT, env=None, check=True, timeout=None, **kwargs):
|
||||
return subprocess.run(list(map(str, command)), cwd=cwd, env=env,
|
||||
check=check, timeout=timeout, **kwargs)
|
||||
|
||||
|
||||
def cli(main):
|
||||
"""Shared exit contract; argparse continues to own help and usage errors."""
|
||||
try:
|
||||
return main() or 0
|
||||
except subprocess.CalledProcessError as error:
|
||||
print(f'Command failed (exit {error.returncode}).', file=sys.stderr)
|
||||
return error.returncode
|
||||
except subprocess.TimeoutExpired:
|
||||
print('Command timed out.', file=sys.stderr)
|
||||
return 1
|
||||
except (RuntimeError, ValueError) as error:
|
||||
print(error, file=sys.stderr)
|
||||
return 1
|
||||
except OSError:
|
||||
print('Required tool or file is unavailable; check paths and permissions.', file=sys.stderr)
|
||||
return 1
|
||||
except KeyboardInterrupt:
|
||||
return 130
|
||||
Reference in new issue
Block a user