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

+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)." }
}