Files
cutdex/tool/check.py
T
lingjhf 152c051a29
Gitea CI / Check code and tests (pull_request) Failing after 8m56s
Gitea CI / Build Android APK (pull_request) Skipped
Gitea CI / Build Windows x64 app (pull_request) Skipped
Gitea CI / Audit and package Windows x64 (pull_request) Skipped
Gitea CI / Assemble and validate CI artifacts (pull_request) Skipped
Gitea CI / Gitea CI passed (pull_request) Failing after 4s
refactor(build): unify SDK configuration and release tooling
Pin Flutter with FVM and share local environment loading across IDE, Python, and Dart entrypoints. Keep CI on the verified preinstalled SDK and skip local overrides.

Extract common build presets, process execution, and file hashing. Propagate project roots through SDK selection and release commands, and migrate macOS release, signing, and DMG orchestration to Python.

Reuse local check suites in CI, support Android source overrides, and update documentation and regression tests.
2026-10-06 22:24:32 +08:00

69 lines
2.5 KiB
Python

#!/usr/bin/env python3
"""Check code, application/package tests and tools without building or publishing an app."""
import argparse
import ast
import os
import sys
from project_tools import ROOT, host_bash, project_environment, tool_command
from common.process import cli, run as run_command
def run(command):
print('+ ' + ' '.join(map(str, command)), flush=True)
run_command(command)
def check_tools():
tool_roots = [ROOT / 'tool', *(ROOT / 'packages').glob('*/tool')]
for path in sorted(path for directory in tool_roots for path in directory.rglob('*.py')):
ast.parse(path.read_text(encoding='utf-8'), filename=str(path))
print('Python syntax: passed', flush=True)
bash = host_bash()
if bash:
for path in sorted(path for directory in tool_roots for path in directory.rglob('*.sh')):
run([bash, '-n', path.as_posix()])
else:
print('Shell syntax: skipped (bash unavailable)', flush=True)
python = sys.executable
run([python, 'tool/check_public_repository.py'])
run([python, 'tool/check_package_boundaries.py'])
for directory, pattern in [
('tool/macos', '*_unit.py'),
('tool/tests', '*_test.py'),
('tool/windows', 'test_check_windows_release.py'),
('tool/windows', '*_unit.py'),
('tool/gitea', 'test_*.py'),
]:
run([python, '-m', 'unittest', 'discover', '-s', directory, '-p', pattern])
def check_analyze():
run(tool_command('dart', ['analyze', '--fatal-infos']))
def check_flutter():
package_tests = sorted(str(path.relative_to(ROOT)) for path in (ROOT / 'packages').glob('*/test'))
run(tool_command('flutter', ['test', '--reporter', 'expanded', 'test', *package_tests]))
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--suite', choices=['all', 'analyze', 'flutter', 'tools'], default='all',
help='CI runs the same suites as the default local check')
args = parser.parse_args()
if sys.version_info < (3, 11):
raise SystemExit('Python 3.11 or newer is required for repository tooling.')
environment = project_environment()
# Cross-language tests and child scripts inherit this same SDK and config.
os.environ.clear()
os.environ.update(environment)
suites = {'analyze': check_analyze, 'flutter': check_flutter, 'tools': check_tools}
for name, check in suites.items():
if args.suite in ('all', name):
check()
if __name__ == '__main__':
sys.exit(cli(main))