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

This commit was merged in pull request #9.
This commit is contained in:
lingjhf committed 2026-10-06 16:14:42 +00:00
1 parent a13a54d5ec
commit 4a759d81a6
61 files changed
+1913 -388

No files matched your search

+6 -1
View File
@@ -1,6 +1,6 @@
# Gitea Windows and Android builds
The Windows x64 host runner needs Flutter 3.47.5, Python, Node, Visual Studio C++,
The Windows x64 host runner needs the Flutter version pinned in `.fvmrc`, Python, Node, Visual Studio C++,
JDK 21 and Android SDK 36. The native cutdex_windows Release and cutdex_android
Maven packages must be published before building this app. The SDK Git dependency
is pinned to Gitea; the runner account needs SSH access to that private repository.
@@ -13,6 +13,11 @@ shipping a production signed Android release. The Windows ZIP includes the whole
Flutter Release directory and passes the PE dependency audit. Processing workers
and optional models are separate; these four repositories contain no worker bundle.
CI and local checks share `tool/check.py` suites for analysis, app/package tests
and repository/tool tests. Local tooling loads `.env.local` with the project FVM
SDK; CI uses its version-verified preinstalled SDK and ignores that file. Both
use `tool/build.py` production/release presets for platform compilation.
CI always analyzes and tests the app. Ordinary code PRs also compile both
platforms, but skip Windows packaging, artifact uploads and final assembly.
Documentation-only PRs skip platform compilation as well. PR changes to CI,
+15 -3
View File
@@ -4,7 +4,7 @@ The workflow runs checks first, then Android and Windows compilation concurrentl
when compilation is required. Ordinary code PRs stop after compilation and native
SDK validation; they skip artifact transfers, Windows packaging and assembly.
Documentation-only PRs run checks without compiling either platform. Changes to
CI, tooling, native platform configuration, dependencies and app update code
CI, tooling, native platform configuration, dependencies, `.fvmrc` and app update code
force the full pipeline. Main pushes and manual CI runs always use the full
pipeline, preserving the exact-commit artifacts needed by Release.
@@ -32,8 +32,20 @@ With an ephemeral runner, these user directories must be persisted separately.
The local `prepare-flutter` action owns cache setup, Flutter version validation,
optional Java configuration and locked dependency resolution for the quality,
Android and Windows compilation jobs. `FLUTTER_VERSION` is declared once in the
CI workflow. The separate `prepare-windows-packaging` action owns the user .NET
Android and Windows compilation jobs. `.fvmrc` is the shared local/CI Flutter
version source; the action verifies the preinstalled runner SDK against it, without
installing FVM or resolving a second SDK. Quality checks also run the Flutter
Python version guard and local launcher regression tests. The guard reads `.fvmrc`
before probing the runner SDK and requires no PowerShell-specific implementation.
Local and CI checks share
`tool/check.py --suite analyze|flutter|tools`, including fatal-info analysis,
app/package tests, repository hygiene and portable tooling regressions. Each suite
remains a separate CI step. `tool/build.py` owns production/release defaults and
Android architectures; SDK selection and environment loading use the shared Dart
launcher through its Python adapter. The runner continues using its verified
preinstalled SDK rather than requiring a project FVM link. Platform builds clear their
local native source path environment overrides and never read `.env.local`.
The separate `prepare-windows-packaging` action owns the user .NET
installation and packaging tool setup, so packaging retries do not resolve
Flutter dependencies. Individual setup steps remain visible within each action.
+1 -13
View File
@@ -1,9 +1,6 @@
name: Prepare Flutter build environment
description: Configure persistent caches, verify Flutter and resolve locked dependencies.
inputs:
flutter-version:
description: Required Flutter framework version
required: true
configure-java:
description: Configure Flutter to use the runner's JAVA_HOME
default: 'false'
@@ -15,16 +12,7 @@ runs:
run: ./tool/gitea/prepare-build-cache.ps1
- name: Verify Flutter version
shell: pwsh
env:
REQUIRED_FLUTTER_VERSION: ${{ inputs.flutter-version }}
run: |
$ErrorActionPreference = 'Stop'
$output = flutter --version --machine
if ($LASTEXITCODE -ne 0) { throw 'Cannot read Flutter version.' }
$version = $output | ConvertFrom-Json
if ($version.frameworkVersion -ne $env:REQUIRED_FLUTTER_VERSION) {
throw "Flutter $env:REQUIRED_FLUTTER_VERSION required; found $($version.frameworkVersion)."
}
run: python tool/gitea/verify_flutter_version.py
- name: Configure Flutter Java
if: ${{ inputs.configure-java == 'true' }}
shell: pwsh
+10 -15
View File
@@ -12,8 +12,8 @@ concurrency:
group: app-${{ gitea.ref }}
cancel-in-progress: true
env:
CI: 'true'
PYTHONUTF8: '1'
FLUTTER_VERSION: '3.47.5'
CUTDEX_GITEA_INTERNAL_URL: http://127.0.0.1:3000
GIT_CONFIG_COUNT: '2'
GIT_CONFIG_KEY_0: core.autocrlf
@@ -48,18 +48,13 @@ jobs:
- name: Prepare Flutter environment
uses: ./.gitea/actions/prepare-flutter
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
configure-java: 'true'
- name: Analyze Dart code
run: dart analyze --fatal-infos
run: python tool/check.py --suite analyze
- name: Run Flutter tests
run: flutter test --reporter expanded test packages/cutdex_ui/test packages/cutdex_native/test
- name: Test update and release tools
run: |
python -m unittest discover -s tool/gitea -p 'test_*.py'
if ($LASTEXITCODE -ne 0) { throw 'Release tooling tests failed.' }
python -m unittest discover -s tool/windows -p '*_unit.py'
if ($LASTEXITCODE -ne 0) { throw 'Update tooling tests failed.' }
run: python tool/check.py --suite flutter
- name: Check repository and tool tests
run: python tool/check.py --suite tools
android:
name: Build Android APK
@@ -77,7 +72,6 @@ jobs:
- name: Prepare Flutter environment
uses: ./.gitea/actions/prepare-flutter
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
configure-java: 'true'
- name: Configure Gradle memory and build cache
run: |
@@ -87,7 +81,10 @@ jobs:
- name: Build production Android APK
env:
GITEA_ACTOR: lingjhf
run: flutter build apk --release --flavor production --target-platform android-arm64,android-x64
run: |
Remove-Item Env:CUTDEX_ANDROID_PATH -ErrorAction SilentlyContinue
python tool/build.py android
if ($LASTEXITCODE -ne 0) { throw 'Android build failed.' }
- name: Upload Android CI artifact
if: ${{ needs.quality.outputs.package-app == 'true' }}
uses: ./.gitea/actions/upload-artifact
@@ -112,12 +109,10 @@ jobs:
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
- name: Prepare Flutter environment
uses: ./.gitea/actions/prepare-flutter
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Build production Windows app
run: |
Remove-Item Env:CUTDEX_WINDOWS_PATH, Env:CUTDEX_WINDOWS_PACKAGE_PATH -ErrorAction SilentlyContinue
flutter build windows --release --flavor production
python tool/build.py windows
if ($LASTEXITCODE -ne 0) { throw 'Windows build failed.' }
- name: Verify native SDK matches pinned packaging tools
run: |