Files
cutdex/.gitea/CI_PERFORMANCE.md
T
lingjhf 06f1c26681
Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
Move editor UI into the app and release verified Core dependencies (#14)
2026-10-11 19:59:40 +00:00

11 KiB

CI build performance

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, .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.

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 builds the APK. The final job downloads only platform packages and validates the complete release manifest, update feed and checksums. The public artifact remains cutdex-release-packages.

Build jobs explicitly use persistent runner-user Pub and Gradle caches, respecting existing PUB_CACHE and GRADLE_USER_HOME overrides. Gradle task output caching is enabled for CI. Do not clear these caches between runs. Each job must have its own checkout; do not share a Flutter build/ or .dart_tool/ directory between jobs. With an ephemeral runner, these user directories must be persisted separately.

The Windows compilation job runs tool/windows/native_cache.py after locked Pub resolution. It reads the Velopack version and SHA256 from the resolved deskup package and persists its ZIP in %LOCALAPPDATA%/Cutdex/ci-tools/native/, keyed by both values. Every reuse verifies the digest; corrupt files are replaced only after a verified download. OS file locks coordinate concurrent jobs, and atomic replacement prevents interrupted downloads from becoming cache hits. Temporary network failures retry at most three times. DESKUP_VELOPACK_ARCHIVE points CMake at the verified local ZIP, where the SDK performs its own hash check again. An explicitly supplied offline archive is validated and can populate this cache. Version or hash changes use a separate file; no checkout-local _deps directory is shared. Persist this user cache too when using ephemeral runners.

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. .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.

Workflow-level environment variables contain only shared nonsecret settings. The SDK token is limited to quality and platform compilation jobs. The fixed Maven account name is set only on the Android build step, matching the SDK token owner rather than the user who triggered CI. Assembly needs no SDK credentials; Release credentials remain confined to the Release workflow's publishing jobs.

Build commands keep Flutter's default Pub preparation after the explicit locked resolution. Do not use --no-pub: Flutter also regenerates release plugin registrants in that preparation, removing dev-only plugins such as integration_test.

The runner needs at least two execution slots. The local runner configuration at D:/workspace/gitea-stack/runner/config.yaml currently has capacity: 2. The host has 12 logical processors and approximately 16 GB RAM; the Android job retains its 3 GB heap and four-worker limit to leave room for concurrent Windows compilation.

prepare-package-tools.ps1 installs pinned pefile and vpk on first use under the runner user's %LOCALAPPDATA%/Cutdex/ci-tools/. Later builds reuse them after version checks. Python interpreter identity and tool versions isolate the cache, and a mutex protects installation across concurrent workflows. .NET setup remains in the Windows packaging job to provide SDK 10 and the runtime required by vpk. The .NET installation uses the runner user's Cutdex/ci-tools/dotnet directory through DOTNET_INSTALL_DIR and DOTNET_ROOT, so setup needs no administrator access and later jobs reuse the installed SDK and runtime. The Windows build verifies that the resolved deskup native SDK matches the pinned Velopack version before saving the app. Packaging imports no Flutter package configuration and independently verifies the installed vpk version.

APK and Windows package uploads use compression-level: 0 to avoid recompressing already compressed artifacts. The saved Windows app uses compression level 1, preserves nested and hidden runtime assets, and excludes the same debug files and optional workers omitted by packaging. The saved app, platform packages, compact metadata and validated release artifact all retain 30 days.

This host runs both Gitea and the runner. The workflows set CUTDEX_GITEA_INTERNAL_URL=http://127.0.0.1:3000 and override ACTIONS_RESULTS_URL on artifact upload/download steps, so those transfers stay on the host instead of looping through the public FRP tunnel. Release API uploads and byte verification also use this loopback endpoint; tooling rewrites only the validated public Gitea origin. The server's public URL remains https://git.orangraph.com, and the runner registration is unchanged. These workflow labels require this shared-host layout; configure a reachable private endpoint before using runners on other hosts. Checkout uses the same endpoint through its github-server-url input, retaining the requested commit/tag and disabling persisted credentials. Release requests retain the public Host header so Gitea response links pass the public-origin checks. CI artifact ZIP download requests retain the loopback Host instead: Gitea returns a signed redirect to the raw archive, and its Host must remain local for that second request to avoid the public tunnel. Release attachment links stay public.

Core source archives are cached by their pinned SHA256 under the runner user's .cache/cutdex/core. Every use verifies the bytes and both dependency identities; the archive is freshly extracted into each job's workspace. Native Flutter is bundled with Core and reused from that one source directory. No application build outputs or package configurations are shared between jobs.

Compare warm CI runs after the first cache fill. Measure checks, Android compile, Windows compile, packaging and artifact transfer separately. Total duration follows the slower platform branch, plus checks and final assembly; no fixed speedup is assumed. Release audits and artifact validation remain mandatory.

Failure recovery

Use Gitea's failed-job rerun rather than rerunning the entire workflow. A job reruns from its first step, including downstream dependent jobs. Once the Windows app artifact has been saved, a Windows packaging failure can be retried without recompilation. Assembly failures reuse the saved Android and Windows packages; Release failures reuse the successful main CI. Splitting Windows adds one app upload/download on successful runs in exchange for this recovery point.

Every CI artifact upload uses the local upload-artifact composite, with at most three action attempts and 5/15-second delays. Attempts replace incomplete artifacts with the same name; each name belongs to one producing job. Exhausted retries fail the job. If the first Windows app checkpoint cannot be uploaded, the build job must still be rerun; it has no saved app to restore.

Release attachment uploads retry temporary network errors, HTTP 408/429 and 500/502/503/504 up to three POST attempts per file, also with 5/15-second delays. The specific FRP HTML "Not Found" page observed during tunnel reconnection is also treated as temporary; ordinary Gitea API or HTML 404 responses still fail. Before retrying a POST, the uploader checks whether Gitea already saved the named attachment, including after the final response is lost. This avoids duplicate uploads after a timeout. Authorization, invalid-input and other permanent errors fail immediately. No draft creation or publication PATCH is automatically retried. Attachment-list reads have their own bounded retries. Final byte verification remains mandatory even when an existing filename is reused.

The tag/manual Release workflow reuses a successful main CI for the exact tagged commit; it performs no Flutter builds, dependency resolution or Windows packaging. A prepare job binds the draft and both platform upload jobs to one CI run. Android and Windows independently fetch and upload their existing packages in parallel. Publication requires the small cutdex-release-metadata artifact; it never downloads the combined binary artifact. Missing or expired metadata/platform artifacts fail preparation, with no old-format fallback. Every remote file is read and verified once, immediately before publication, with two verification workers and 1 MiB chunks. Platform upload steps check presence without repeating binary readbacks. Each upload batch also uses at most two workers; while both platform jobs run, Android can have one upload in flight alongside two Windows uploads. Retries retain the original CI-run binding. Ordinary CI never creates drafts. Wait for main CI success before tagging or retry Release after it finishes; platform Release uploads overlap each other, not the original main builds.