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
@@ -16,7 +16,7 @@ def packaging_change(path):
|
||||
'packages/cutdex_native/windows/',
|
||||
'lib/integrations/app_update',
|
||||
'lib/features/settings/update'))
|
||||
or PurePosixPath(path).name in {'pubspec.yaml', 'pubspec.lock', '.metadata'}
|
||||
or PurePosixPath(path).name in {'pubspec.yaml', 'pubspec.lock', '.metadata', '.fvmrc'}
|
||||
or (path.startswith('test/') and 'update' in path)
|
||||
)
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ import zipfile
|
||||
from release_artifacts import AUDIT, FEED, INSTALLER, PORTABLE, METADATA, app_versions, checksum_lines, validate_artifact
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(ROOT / 'tool'))
|
||||
from common.files import file_sha256
|
||||
from common.process import cli
|
||||
|
||||
|
||||
def validate_apk(apk):
|
||||
@@ -36,8 +39,7 @@ def package_windows(windows, vpk, windows_version):
|
||||
checksums = {}
|
||||
for path in sorted(staged.rglob('*')):
|
||||
if path.is_file():
|
||||
with path.open('rb') as stream:
|
||||
checksums[path.relative_to(staged).as_posix()] = hashlib.file_digest(stream, 'sha256').hexdigest()
|
||||
checksums[path.relative_to(staged).as_posix()] = file_sha256(path)
|
||||
(staged / 'checksums.json').write_text(json.dumps(checksums), encoding='utf-8')
|
||||
result = package_app(staged, releases, vpk, require_processing=False)
|
||||
if result['version'] != windows_version:
|
||||
@@ -105,4 +107,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
sys.exit(cli(main))
|
||||
@@ -32,7 +32,7 @@ class ScopeTests(unittest.TestCase):
|
||||
for path in ('.gitea/workflows/ci.yml', '.gitea/actions/upload-artifact/action.yml',
|
||||
'tool/gitea/ci_scope.py', 'tool/windows/windows_updates.py',
|
||||
'windows/runner/main.cpp.in', 'android/app/build.gradle.kts',
|
||||
'pubspec.yaml', 'pubspec.lock', 'packages/cutdex_ui/pubspec.yaml',
|
||||
'pubspec.yaml', 'pubspec.lock', '.fvmrc', 'packages/cutdex_ui/pubspec.yaml',
|
||||
'packages/cutdex_native/windows/CMakeLists.txt',
|
||||
'lib/integrations/app_update_bridge.dart',
|
||||
'lib/features/settings/update_controller.dart', 'test/app_updates_test.dart'):
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
"""Verify the runner's Flutter version against the exact project .fvmrc pin."""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
from common.process import cli, run
|
||||
|
||||
VERSION = re.compile(r'\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?')
|
||||
|
||||
|
||||
def verify_version(config):
|
||||
try:
|
||||
required = json.loads(config.read_text(encoding='utf-8'))['flutter']
|
||||
except (OSError, ValueError, KeyError, TypeError):
|
||||
raise RuntimeError('.fvmrc must pin an exact Flutter framework version.') from None
|
||||
if not isinstance(required, str) or not VERSION.fullmatch(required):
|
||||
raise RuntimeError('.fvmrc must pin an exact Flutter framework version.')
|
||||
flutter = shutil.which('flutter')
|
||||
if not flutter:
|
||||
raise RuntimeError('Cannot read Flutter version; Flutter is missing on PATH.')
|
||||
try:
|
||||
result = run([flutter, '--version', '--machine'], cwd=config.parent,
|
||||
capture_output=True, text=True, encoding='utf-8', timeout=60)
|
||||
installed = json.loads(result.stdout)['frameworkVersion']
|
||||
except (OSError, subprocess.SubprocessError, ValueError, KeyError, TypeError):
|
||||
raise RuntimeError('Cannot read Flutter version.') from None
|
||||
if not isinstance(installed, str) or not VERSION.fullmatch(installed):
|
||||
raise RuntimeError('Cannot read Flutter framework version.')
|
||||
if installed != required:
|
||||
raise RuntimeError(f'Flutter {required} required by .fvmrc; found {installed}.')
|
||||
return required
|
||||
|
||||
|
||||
def main():
|
||||
argparse.ArgumentParser(description=__doc__).parse_args()
|
||||
version = verify_version(Path.cwd() / '.fvmrc')
|
||||
print(f'Flutter {version} matches .fvmrc.')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(cli(main))
|
||||
Reference in new issue
Block a user