Files
cutdex/.gitea/BUILD_AND_RELEASE.md
lingjhf 8785eaf095
Gitea CI / Check code and tests (push) Failing after 11m29s
Gitea CI / Build Android APK (push) Skipped
Gitea CI / Build Windows x64 app (push) Skipped
Gitea CI / Audit and package Windows x64 (push) Skipped
Gitea CI / Assemble and validate CI artifacts (push) Skipped
Gitea CI / Gitea CI passed (push) Failing after 2s
Recover releases from independently retried CI packaging (#15)
2026-10-11 20:52:05 +00:00

7.6 KiB

Gitea Windows and Android builds

The Windows x64 host runner needs the Flutter version pinned in .fvmrc, Python, Node, Visual Studio C++, JDK 21 and Android SDK 36. dependencies.json fixes the Core release version, source commit and source ZIP SHA256, together with its bundled native Flutter version and commit. .gitea/actions/prepare-flutter downloads that published Core archive and verifies its SHA256 and RELEASE.json before extracting a job-local .dependencies/cutdex_core. The app and preview package both use its native_flutter directory, so Pub resolves one integration source. Core is hosted at lingjhf/cutdex_core; Flutter integration is hosted at cutdex-native/cutdex_native_flutter. Local source development uses the ignored pubspec_overrides.yaml sibling overrides. Release CI does not follow branches or need platform repository checkout steps.

Production Android/Windows CI defaults to CUTDEX_NATIVE_BUILD_MODE=artifacts and consumes the exact platform versions and Windows archive digest recorded by the Flutter integration. Set the repository variable to source only for development CI; that mode lets the Flutter integration fetch the platform's locked SHA during the build. Android uses its single Settings hook; Windows automatically prepares the pinned Rust toolchain/target and verified FFmpeg SDK, then links and bundles DLLs. Applications do not need platform checkout steps or FFMPEG_DIR. Source-mode hosts need Git, Python 3.11+, Rustup/LLVM for Windows and NDK/CMake/MSYS2 for Android. CUTDEX_NATIVE_SOURCE_TOKEN reads private Gitea platform source repositories; CUTDEX_NATIVE_SOURCE_SERVER_URL selects the runner-reachable checkout server. Platform publication and Flutter integration CI are owned by their independent repositories.

Set CUTDEX_GITEA_TOKEN in repository Actions Secrets with repository read and package read access. It authenticates private Gitea native package downloads. The Android APK includes ARM64 and x86_64, uses the production flavor and currently uses the project's debug signing configuration. Configure formal signing before 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 distributed separately; these workflows do not bundle them.

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, 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). 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. 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 similarly reuse their upstream artifacts. Use the failed-job rerun option: a whole-workflow rerun executes compilation again. A job always restarts from its first step. Saving the Windows app adds one artifact transfer between the jobs.

CI artifact uploads attempt at most three times, waiting 5 and 15 seconds between attempts and replacing incomplete artifacts of the same job-owned name. Release attachment uploads use the same bounded delays for temporary HTTP/network errors, and check for already saved filenames before repeating a POST. Permanent errors fail immediately and final attachment byte verification remains required. If the Windows app cannot be saved after all attempts, its build job still needs to be rerun. Draft creation and final publication are not automatically retried.

After main CI succeeds, create v at that exact commit, or manually dispatch the Release workflow with the existing tag. Release preparation selects a successful main ci.yml run for the exact tagged commit and requires unexpired cutdex-android-build, cutdex-windows-build and cutdex-release-metadata artifacts. It creates a draft bound to both that commit and that CI run. Release jobs never rebuild the app or reinstall Flutter dependencies.

Android and Windows independently download their platform artifacts from the selected CI run and immediately upload them to the draft. These jobs run in parallel. The final job accepts only the compact metadata artifact from that same CI run. Complete binary archives cannot substitute for platform packages or metadata. Gitea can retain old artifact API rows after a job rerun despite overwrite. Selection requires the exact CI run and source commit, and exactly one artifact created within its current successful producer job's execution interval. Jobs preserved during a partial rerun retain their original intervals and artifacts. Missing, expired or ambiguous artifacts in that interval block preparation before any draft is created. Platform uploads check attachment presence without reading back their bytes. Before publication, every attachment is read back once and verified against trusted SHA256 checksums; the full update package also matches its index SHA1 and size. Upload and verification batches use at most two requests per job. Verification reads in 1 MiB chunks. Tag, CI, draft and attachment ID/name bindings are rechecked before the Release is made public.

A failed upload leaves the draft unpublished with successful uploads retained. Manual dispatch with the same tag resumes the original CI run, even if another CI for that commit has since succeeded. Matching attachments are reused; changed or unrelated attachments block publication rather than being replaced. If the original platform or metadata artifacts have expired, release preparation fails and requires 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.

Release tools are checked out at the workflow's exact commit; tagged application source is checked out separately in .release-source. A manual dispatch on main can therefore apply a reviewed release-tool fix to an existing tag without moving that tag or substituting another application's version or CI artifacts.

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 promotion entry point or format fallback.