mirror of
https://github.com/fromchat-messenger/app.git
synced 2026-11-16 02:44:54 +03:00
ci(release): workflow_dispatch only so caches survive across releases
- drop the tag-push trigger: caches saved by tag-scoped runs are visible to that tag only (GitHub docs, 'Restrictions for accessing a cache'), so every tag build started cold and warmed nobody - dispatch instead, preferably from the default branch; the tag does not need to exist, publish creates it at the built commit; warn when dispatching from a non-default branch - merge check-build into resolve-version (one runner + one checkout instead of two) - merge record-build into publish: save the build-success marker at the start of publish - fix softprops input: overwrite_existing does not exist upstream (silently ignored); the valid input is overwrite_files ci(release): dump jpackage out/err logs when macOS packaging fails ci(windows): align rust cache save key with restore key (arch + v5) The save action wrote windows-rust-Windows-v3-<lock> with no arch while restore fanned out on windows-rust-Windows-<arch>-v4-<lock> — so every saved entry was unreachable by design. It also made the two matrix legs race to reserve the same key: ARM won, x64 got 'another job may be creating this cache'. Save now uses the exact restore key (arch + v5); restore falls back only to same-arch v5 prefixes to avoid pulling the stale archless v3 entries into the wrong build. ci: add temporary cache-inspect workflow ci(cache): one-shot push trigger so the temp inspector can run from a branch ci(cache): fix field name in inspector (api uses key) ci(cache): inspect via exact original path lists, per-OS matrix ci(cache): save only tools/android/build-jar gradle scopes Packaging scopes' build trees (1.3-2 GB each, 6 scopes) were ~90% installer outputs and jlink runtime duplicates that actions/cache negation patterns are unable to exclude (actions/toolkit#713). Saving ~7 GB per run kept the repo at the 10 GB cache cap and LRU-evicted build-jar/android/windows-rust entries within minutes of being saved. Packaging scopes are now restore-only: they fall back to the build-jar scope via restore-keys, and their outputs regenerate from the JAR artifact in a couple of minutes. Also remove the temporary cache-inspect workflow (purpose served). ci(cache): unify gradle-build path lists so restore-keys cross-hit Restores differ per path list: actions/cache computes a version stamp from the path list and only matches restore-keys via a version stamp (hash of the path list): entries with different path lists are invisible to each other's restore-keys, even with a shared key prefix. The build-jar scope kept compose/tmp while the generic list negated it, so the '-v2-build-jar-' fallback never matched for packaging scopes (measured in run 39349881796: 'Cache not found' listing the fallback prefix). Drop the ineffective '!*/compose/tmp' negation (no-op at save time anyway per actions/toolkit#713) so all non-android scopes share one version stamp; packaging restores now warm from the build-jar entry. ci: enable Gradle configuration cache in CI; temporary --profile on Linux packaging ci: revert configuration cache (script-closure tasks not serializable); keep --profile diagnostic ci: drop temporary --profile diagnostic (profile captured; deb/rpm identified as the quiet ~45s/~23s hogs) ci: build the macOS x64 DMG on an Intel runner (macos-26-intel) macos-latest resolves to an arm64 image, so the 'Intel' matrix job ran on Apple Silicon and jpackage shipped arm64 binaries under the -intel.dmg name (v1.2.0-beta18): Intel Macs refuse it with 'this program isn't supported on this mac'. jpackage cannot cross-build, and the Gradle daemon JVM criteria (gradle-daemon-jvm.properties) provision the daemon for the host arch, so every arch decision followed the runner. Pin each matrix entry to its native runner. proguard: keep JNA entire API from stripping (native GetStaticMethodID lookups) jnidispatch resolves com.sun.jna.Native#dispose by name from native code during initIDs; ProGuard stripped it (not a Java-native method, no Java references), so every Windows package died at launch with 'Failed to launch JVM': UnsatisfiedLinkError: Can't obtain static method dispose from class com.sun.jna.Native at com.sun.jna.platform.win32.Shell32.<clinit> Linux/macOS never load Shell32, so only Windows builds were affected (both x64 and arm64). Also keep classes extending/implementing JNA (Libraries, Callbacks, Structures are loaded reflectively at runtime). ci: speed up release builds; desktop/chat and theme updates Share JVM compile outputs from Build JAR, fix macOS Playwright caching, cache DMG export, and enable configuration cache on CI. Includes desktop chrome, attachment preview, system theme, and related shared fixes. Co-authored-by: Cursor <cursoragent@cursor.com> ci: drop configuration cache on release (Compose ProGuard incompatible) Co-authored-by: Cursor <cursoragent@cursor.com> ci: skip JVM recompile on macOS/Windows when Build JAR artifact is restored Gradle has no cross-OS execution history for restored classes; gate compileKotlinJvm, desktop compileKotlin, and generateAppBuildInfo when FROMCHAT_PREBUILT_JVM is set and outputs are present. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,8 +16,7 @@ runs:
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
app/desktop/windows-setup/target
|
||||
key: windows-rust-${{ runner.os }}-${{ runner.arch }}-v4-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
|
||||
key: windows-rust-${{ runner.os }}-${{ runner.arch }}-v5-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
windows-rust-${{ runner.os }}-${{ runner.arch }}-v4-
|
||||
windows-rust-${{ runner.os }}-${{ runner.arch }}-v3-
|
||||
windows-rust-${{ runner.os }}-${{ runner.arch }}-v5-
|
||||
cargo-registry-${{ runner.os }}-
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Restore JVM compile outputs
|
||||
description: Verify JVM compile outputs from the Build JAR artifact are present before packaging
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Verify JVM compile outputs
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
missing=false
|
||||
for path in \
|
||||
app/shared/build/classes/kotlin/jvm/main \
|
||||
app/shared/build/generated/sources/appBuildInfo/kotlin \
|
||||
utils/shared/build/classes/kotlin/jvm/main \
|
||||
app/desktop/build/classes/kotlin/main
|
||||
do
|
||||
if [[ ! -d "$path" ]]; then
|
||||
echo "Missing $path" >&2
|
||||
missing=true
|
||||
fi
|
||||
done
|
||||
if [[ "$missing" == "true" ]]; then
|
||||
echo "JVM compile outputs artifact is incomplete" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "JVM compile outputs verified"
|
||||
@@ -42,8 +42,29 @@ runs:
|
||||
!app/desktop/build/distributions
|
||||
!app/desktop/build/ci
|
||||
!app/desktop/build/compose/binaries
|
||||
- name: Save Gradle build cache
|
||||
if: inputs.scope != 'android' && inputs.scope != 'build-jar'
|
||||
# Restore-only for the desktop packaging scopes (linux-*, windows-package-*,
|
||||
# macos-*): measurements showed their build trees are ~1.3–2 GB each and are
|
||||
# dominated by installer outputs (deb/rpm/AppImage/DMG/Setup.exe), the jpackage
|
||||
# runtime image copied up to four times, and staged ProGuard jars — all of which
|
||||
# regenerate from the Build JAR artifact in a few minutes. Saving six 1.3–2 GB
|
||||
# entries per run kept the repo pinned at the 10 GB cache cap and LRU-evicted
|
||||
# the entries that actually matter (build-jar, android, windows-rust) within
|
||||
# minutes. Their restores now fall back to the build-jar scope via restore-keys.
|
||||
# (Note: actions/cache negated path patterns cannot exclude subtrees of an
|
||||
# included parent directory — actions/toolkit#713 — so "!distributions" style
|
||||
# exclusions are no-ops here; not saving at all is the only reliable trim.)
|
||||
- name: Save Gradle build cache (windows-tools only)
|
||||
if: >-
|
||||
inputs.scope != 'android' && inputs.scope != 'build-jar' &&
|
||||
!startsWith(inputs.scope, 'linux-') &&
|
||||
!startsWith(inputs.scope, 'windows-package-') &&
|
||||
!startsWith(inputs.scope, 'macos-')
|
||||
# Path list must stay byte-identical to the generic restore list in
|
||||
# cache-gradle-build: actions/cache refuses to save when the restore and save
|
||||
# paths differ, and the version stamp (hash of the path list) gates any later
|
||||
# restore — including cross-scope restore-key fallbacks. compose/tmp is kept
|
||||
# here on purpose (holds ProGuard's output jars; small); see the matching
|
||||
# comment in cache-gradle-build.
|
||||
uses: actions/cache/save@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
@@ -57,4 +78,3 @@ runs:
|
||||
!app/desktop/build/distributions
|
||||
!app/desktop/build/ci
|
||||
!app/desktop/build/compose/binaries
|
||||
!app/desktop/build/compose/tmp
|
||||
|
||||
@@ -4,10 +4,15 @@ description: Save Cargo registry, git checkouts, and the windows-setup target di
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
# The save key MUST match cache-windows-rust-tools' exact restore key byte for byte: it has to
|
||||
# carry runner.arch — the two matrix legs race to save the same key otherwise (actions/cache
|
||||
# rejects the second with "another job may be creating this cache"), and a saved entry without
|
||||
# the arch can never be restored because no restore key matches its shape. v3 was an archless
|
||||
# relic: every entry it ever wrote was dead on arrival.
|
||||
- uses: actions/cache/save@v5
|
||||
continue-on-error: true
|
||||
with:
|
||||
key: windows-rust-${{ runner.os }}-v3-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
|
||||
key: windows-rust-${{ runner.os }}-${{ runner.arch }}-v5-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }}
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
|
||||
@@ -174,6 +174,7 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
env:
|
||||
FROMCHAT_PREBUILT_PROGUARD: "0"
|
||||
ORG_GRADLE_PROJECT_org.gradle.workers.max: "4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: ./.github/actions/restore-git-mtimes
|
||||
@@ -199,6 +200,16 @@ jobs:
|
||||
path: app/desktop/build/ci/proguard/
|
||||
if-no-files-found: error
|
||||
retention-days: 3
|
||||
- uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: jvm-compile-outputs
|
||||
path: |
|
||||
app/shared/build
|
||||
utils/shared/build
|
||||
app/desktop/build/classes
|
||||
app/desktop/build/libs
|
||||
if-no-files-found: error
|
||||
retention-days: 3
|
||||
|
||||
windows-tools:
|
||||
name: Windows tools (${{ matrix.label }})
|
||||
@@ -285,6 +296,7 @@ jobs:
|
||||
if: needs.check-build.outputs.should_build == 'true'
|
||||
env:
|
||||
FROMCHAT_PREBUILT_PROGUARD: "1"
|
||||
FROMCHAT_PREBUILT_JVM: "1"
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -328,6 +340,11 @@ jobs:
|
||||
with:
|
||||
name: desktop-proguard
|
||||
path: app/desktop/build/prebuilt/main-release/proguard
|
||||
- uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: jvm-compile-outputs
|
||||
path: .
|
||||
- uses: ./.github/actions/restore-jvm-compile-outputs
|
||||
# Tooling for this architecture, built natively by the windows-tools matrix leg. The two
|
||||
# architectures must not share: fromchat-pack selects the embedded payload with
|
||||
# std::env::consts::ARCH, so an x64 stub on ARM64 reports "x86_64" and finds no x86_64
|
||||
@@ -369,15 +386,20 @@ jobs:
|
||||
if: needs.check-build.outputs.should_build == 'true'
|
||||
env:
|
||||
FROMCHAT_PREBUILT_PROGUARD: "1"
|
||||
FROMCHAT_PREBUILT_JVM: "1"
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: arm64
|
||||
label: Apple Silicon
|
||||
runner: macos-latest
|
||||
# jpackage cannot cross-build: on an arm64 runner this job silently ships
|
||||
# arm64 binaries under the -intel.dmg name (beta18 did exactly that).
|
||||
- arch: x64
|
||||
label: Intel
|
||||
runs-on: macos-latest
|
||||
runner: macos-26-intel
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
@@ -402,28 +424,56 @@ jobs:
|
||||
with:
|
||||
name: desktop-proguard
|
||||
path: app/desktop/build/prebuilt/main-release/proguard
|
||||
- uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: jvm-compile-outputs
|
||||
path: .
|
||||
- uses: ./.github/actions/restore-jvm-compile-outputs
|
||||
- name: Cache DMG background tooling
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
app/desktop/dmg-background/node_modules
|
||||
~/.cache/ms-playwright
|
||||
app/desktop/dmg-background/.playwright-browsers
|
||||
key: dmg-tools-${{ runner.arch }}-${{ hashFiles('app/desktop/dmg-background/package-lock.json') }}
|
||||
restore-keys: dmg-tools-${{ runner.arch }}-
|
||||
- name: Cache DMG export output
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: app/desktop/build/dmg-background/dist
|
||||
key: dmg-export-${{ runner.arch }}-${{ hashFiles('app/desktop/dmg-background/**', 'app/shared/src/commonMain/composeResources/drawable/logo_square.png') }}
|
||||
restore-keys: dmg-export-${{ runner.arch }}-
|
||||
- name: Install macOS packaging tools
|
||||
env:
|
||||
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/app/desktop/dmg-background/.playwright-browsers
|
||||
run: |
|
||||
if ! command -v create-dmg >/dev/null 2>&1; then
|
||||
brew install create-dmg
|
||||
fi
|
||||
DMG_DIR="app/desktop/dmg-background"
|
||||
mkdir -p "$PLAYWRIGHT_BROWSERS_PATH"
|
||||
if [[ ! -f "$DMG_DIR/node_modules/playwright/package.json" ]]; then
|
||||
npm --prefix "$DMG_DIR" ci --no-fund --no-audit
|
||||
fi
|
||||
npm --prefix "$DMG_DIR" exec playwright install chromium
|
||||
echo "FROMCHAT_DMG_TOOLS_READY=1" >> "$GITHUB_ENV"
|
||||
echo "PLAYWRIGHT_BROWSERS_PATH=$PLAYWRIGHT_BROWSERS_PATH" >> "$GITHUB_ENV"
|
||||
- name: Package macOS ${{ matrix.arch }}
|
||||
run: |
|
||||
export FROMCHAT_PACKAGING_JDK="$JAVA_HOME"
|
||||
./gradlew :app:desktop:packageReleaseMac -PdesktopArch=${{ matrix.arch }} --no-daemon --console=plain
|
||||
# jpackage only reports its error text in files on the runner surface — surface them.
|
||||
- name: Dump jpackage logs on failure
|
||||
if: failure()
|
||||
run: |
|
||||
for t in createReleaseDistributable createDmgOther; do
|
||||
D="app/desktop/build/compose/logs/$t"
|
||||
[[ -d "$D" ]] || continue
|
||||
for f in "$D"/*.txt; do
|
||||
echo "===== $f"
|
||||
cat "$f"
|
||||
done
|
||||
done
|
||||
- uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: macos-${{ matrix.arch }}
|
||||
@@ -440,6 +490,7 @@ jobs:
|
||||
if: needs.check-build.outputs.should_build == 'true'
|
||||
env:
|
||||
FROMCHAT_PREBUILT_PROGUARD: "1"
|
||||
FROMCHAT_PREBUILT_JVM: "1"
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -472,6 +523,11 @@ jobs:
|
||||
with:
|
||||
name: desktop-proguard
|
||||
path: app/desktop/build/prebuilt/main-release/proguard
|
||||
- uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: jvm-compile-outputs
|
||||
path: .
|
||||
- uses: ./.github/actions/restore-jvm-compile-outputs
|
||||
- name: Install Linux packaging tools
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@@ -489,6 +545,9 @@ jobs:
|
||||
run: |
|
||||
# Keep the jmods-capable JDK the setup action exported; fall back to JAVA_HOME.
|
||||
export FROMCHAT_PACKAGING_JDK="${FROMCHAT_PACKAGING_JDK:-$JAVA_HOME}"
|
||||
# packageReleaseDeb/rpm are the slow, quiet parts of this invocation (profiled 2026-10-20:
|
||||
# ~45s/~23s single-threaded jpackage compression) — candidates for parallel-invocation
|
||||
# packaging if we ever want to shorten this leg.
|
||||
./gradlew :app:desktop:packageReleaseLinux -PdesktopArch=${{ matrix.arch }} --no-daemon --console=plain
|
||||
- uses: actions/upload-artifact@v5
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user