perf(ci): tier PR builds and skip routine release packaging
Gitea CI / Check code and tests (pull_request) Successful in 7m19s
Gitea CI / Build Android APK (pull_request) Successful in 4m34s
Gitea CI / Build Windows x64 app (pull_request) Successful in 3m18s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 55s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 48s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s

This commit is contained in:
lingjhf committed 2026-10-06 18:11:54 +08:00
1 parent 20f5c1036d
commit ca2efdaf18
5 files changed
+246 -11

No files matched your search

+13 -5
View File
@@ -13,13 +13,21 @@ 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.
PR/main CI analyzes and tests the app, builds both platforms, and uploads
cutdex-release-packages including SHA256SUMS and a release manifest. It also saves
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,
tooling, native platform configuration, package dependencies or app update code
run the complete pipeline. `ci_scope.py` compares the PR base and head using Git
history, including deleted files; a failed comparison fails code checks.
Main pushes and manual CI runs always execute the complete pipeline and upload
cutdex-release-packages including SHA256SUMS and a release manifest. They also save
cutdex-release-metadata containing only the manifest, checksums, Windows update
index and audit report. Platform, complete and metadata artifacts retain 30 days. Protect main
with `Gitea CI / Gitea CI passed (pull_request)`.
with `Gitea CI / Gitea CI passed (pull_request)`. This required check validates
every expected job and permits skipped jobs only when the selected scope
explicitly excludes them; failures, cancellations and unexpected skips fail it.
Windows compilation and packaging are separate jobs. Compilation saves the
Windows compilation and packaging are separate jobs. Full-pipeline compilation saves the
unpackaged Release directory as `cutdex-windows-app` for 30 days; packaging
downloads it and runs the existing PE audit and Velopack tools. Rerunning a failed
packaging job reuses this app without recompiling. Assembly and Release jobs
@@ -62,7 +70,7 @@ operator attention. Published Releases are never overwritten. The built-in
GITEA_TOKEN handles release writes and Actions artifact reads; no separate
release-write PAT is required. Do not commit credentials or keystores.
PR/main CI produces Actions artifacts without creating Releases. If a tag is pushed
Full-pipeline CI produces Actions artifacts without creating Releases. If a tag is pushed
before main CI succeeds, release preparation fails without creating a draft; retry
the Release workflow once CI has finished. This design overlaps platform uploads,
not main CI builds with Release uploads. There is no legacy whole-archive
+17 -1
View File
@@ -1,6 +1,22 @@
# CI build performance
The workflow runs checks first, then Android and Windows compilation concurrently.
The workflow runs checks first, then Android and Windows compilation concurrently
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
force the full pipeline. Main pushes and manual CI runs always use the full
pipeline, preserving the exact-commit artifacts needed by Release.
Scope selection uses the complete PR base/head history in the quality checkout.
Other checkouts retain their default shallow fetch. Git comparisons include
deleted paths and disable rename detection, so moving a packaging file into docs
cannot hide its deletion. Unknown paths compile both platforms; empty PR diffs
run the full pipeline. Scope selection errors fail CI instead of skipping jobs.
The final required check requires success for selected jobs and `skipped` for
excluded jobs, and always requires successful code checks.
In the full pipeline,
Windows compilation saves `cutdex-windows-app`; an independent Windows job
downloads that app, audits it and creates Velopack packages. Packaging needs
neither Flutter dependencies nor another Windows compilation. The Android job
+47 -5
View File
@@ -24,6 +24,9 @@ jobs:
quality:
name: Check code and tests
runs-on: cutdex-windows-x64
outputs:
build-app: ${{ steps.scope.outputs.build-app }}
package-app: ${{ steps.scope.outputs.package-app }}
env:
CUTDEX_GITEA_TOKEN: ${{ secrets.CUTDEX_GITEA_TOKEN }}
steps:
@@ -32,6 +35,16 @@ jobs:
with:
persist-credentials: false
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
fetch-depth: 0
- name: Select compilation and packaging scope
id: scope
env:
CI_EVENT_NAME: ${{ gitea.event_name }}
CI_PR_BASE_SHA: ${{ gitea.event.pull_request.base.sha }}
CI_PR_HEAD_SHA: ${{ gitea.event.pull_request.head.sha }}
run: |
python tool/gitea/ci_scope.py
if ($LASTEXITCODE -ne 0) { throw 'CI scope selection failed.' }
- name: Prepare Flutter environment
uses: ./.gitea/actions/prepare-flutter
with:
@@ -51,6 +64,7 @@ jobs:
android:
name: Build Android APK
needs: quality
if: ${{ needs.quality.outputs.build-app == 'true' }}
runs-on: cutdex-windows-x64
env:
CUTDEX_GITEA_TOKEN: ${{ secrets.CUTDEX_GITEA_TOKEN }}
@@ -75,6 +89,7 @@ jobs:
GITEA_ACTOR: lingjhf
run: flutter build apk --release --flavor production --target-platform android-arm64,android-x64
- name: Upload Android CI artifact
if: ${{ needs.quality.outputs.package-app == 'true' }}
uses: ./.gitea/actions/upload-artifact
with:
name: cutdex-android-build
@@ -85,6 +100,7 @@ jobs:
windows-build:
name: Build Windows x64 app
needs: quality
if: ${{ needs.quality.outputs.build-app == 'true' }}
runs-on: cutdex-windows-x64
env:
CUTDEX_GITEA_TOKEN: ${{ secrets.CUTDEX_GITEA_TOKEN }}
@@ -108,6 +124,7 @@ jobs:
python tool/windows/windows_updates.py verify-sdk
if ($LASTEXITCODE -ne 0) { throw 'Windows native SDK version validation failed.' }
- name: Save Windows app for independent packaging retries
if: ${{ needs.quality.outputs.package-app == 'true' }}
uses: ./.gitea/actions/upload-artifact
with:
name: cutdex-windows-app
@@ -123,7 +140,8 @@ jobs:
windows:
name: Audit and package Windows x64
needs: windows-build
needs: [quality, windows-build]
if: ${{ needs.quality.outputs.package-app == 'true' }}
runs-on: cutdex-windows-x64
steps:
- name: Check out source
@@ -154,7 +172,8 @@ jobs:
build:
name: Assemble and validate CI artifacts
needs: [android, windows]
needs: [quality, android, windows]
if: ${{ needs.quality.outputs.package-app == 'true' }}
runs-on: cutdex-windows-x64
steps:
- name: Check out source
@@ -197,11 +216,34 @@ jobs:
checks:
name: Gitea CI passed
if: always()
needs: build
needs: [quality, android, windows-build, windows, build]
runs-on: cutdex-windows-x64
steps:
- name: Verify CI result
env:
RESULT: ${{ needs.build.result }}
QUALITY_RESULT: ${{ needs.quality.result }}
BUILD_APP: ${{ needs.quality.outputs.build-app }}
PACKAGE_APP: ${{ needs.quality.outputs.package-app }}
# The local runner omits results for jobs excluded by their condition.
# Required jobs still fail below if this becomes 'skipped'.
ANDROID_RESULT: ${{ needs.android.result || 'skipped' }}
WINDOWS_BUILD_RESULT: ${{ needs.windows-build.result || 'skipped' }}
WINDOWS_PACKAGE_RESULT: ${{ needs.windows.result || 'skipped' }}
ASSEMBLY_RESULT: ${{ needs.build.result || 'skipped' }}
run: |
if ($env:RESULT -ne 'success') { throw "App build: $env:RESULT" }
if ($env:QUALITY_RESULT -ne 'success') { throw "Code checks: $env:QUALITY_RESULT" }
if ($env:BUILD_APP -notin @('true', 'false') -or $env:PACKAGE_APP -notin @('true', 'false')) {
throw 'Missing or invalid CI scope outputs.'
}
if ($env:PACKAGE_APP -eq 'true' -and $env:BUILD_APP -ne 'true') { throw 'Packaging requires compilation.' }
$compileResult = if ($env:BUILD_APP -eq 'true') { 'success' } else { 'skipped' }
$packageResult = if ($env:PACKAGE_APP -eq 'true') { 'success' } else { 'skipped' }
$jobs = @(
@{ Name = 'Android compilation'; Result = $env:ANDROID_RESULT; Expected = $compileResult },
@{ Name = 'Windows compilation'; Result = $env:WINDOWS_BUILD_RESULT; Expected = $compileResult },
@{ Name = 'Windows packaging'; Result = $env:WINDOWS_PACKAGE_RESULT; Expected = $packageResult },
@{ Name = 'Artifact assembly'; Result = $env:ASSEMBLY_RESULT; Expected = $packageResult }
)
foreach ($job in $jobs) {
if ($job.Result -ne $job.Expected) { throw "$($job.Name): $($job.Result), expected $($job.Expected)." }
}