mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-10-09 20:11:34 -04:00
feat: adopt gradle-flatpak-sources plugin for offline Flatpak builds (#5619)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
14 files changed
+229
-503
No files matched your search
@@ -371,7 +371,7 @@ jobs:
|
||||
cache_read_only: 'true'
|
||||
|
||||
# Uses an isolated Gradle user home so every artifact actually traverses the
|
||||
# network — meshtastic.flatpak-ops captures URLs via BuildOperationListener and
|
||||
# network — the flatpak-sources plugin captures URLs via BuildOperationListener and
|
||||
# only sees ExternalResourceReadBuildOperation events for cache misses. With the
|
||||
# shared cache, downloads would be skipped and the manifest would be (nearly) empty.
|
||||
# We drive packageUberJarForCurrentOS — the same task the in-flatpak build invokes —
|
||||
@@ -381,11 +381,10 @@ jobs:
|
||||
run: >
|
||||
./gradlew --no-build-cache --no-configuration-cache
|
||||
-Dgradle.user.home=${{ runner.temp }}/flatpak-gradle-home
|
||||
-I gradle/init-scripts/flatpak-ops.init.gradle.kts
|
||||
:desktopApp:packageUberJarForCurrentOS :captureFlatpakSources
|
||||
|
||||
- name: Stage manifest
|
||||
run: cp build/flatpak-ops-sources.json flatpak-sources.json
|
||||
run: cp build/flatpak-sources.json flatpak-sources.json
|
||||
|
||||
- name: List Flatpak source files
|
||||
run: ls -l flatpak-sources.json
|
||||
|
||||
@@ -582,11 +582,10 @@ jobs:
|
||||
run: >
|
||||
./gradlew --no-build-cache --no-configuration-cache
|
||||
-Dgradle.user.home=${{ runner.temp }}/flatpak-gradle-home
|
||||
-I gradle/init-scripts/flatpak-ops.init.gradle.kts
|
||||
:desktopApp:packageUberJarForCurrentOS :captureFlatpakSources
|
||||
|
||||
- name: Stage manifest
|
||||
run: cp build/flatpak-ops-sources.json flatpak-sources.json
|
||||
run: cp build/flatpak-sources.json flatpak-sources.json
|
||||
|
||||
- run: ls -lah flatpak-sources.json
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
name: Verify Flatpak Offline Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'scripts/verify-flatpak/**'
|
||||
- 'build.gradle.kts'
|
||||
- 'settings.gradle.kts'
|
||||
- '.github/workflows/verify-flatpak.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: flatpak-verify-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
generate-sources:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Generate flatpak-sources.json
|
||||
run: |
|
||||
./gradlew --no-build-cache --no-configuration-cache \
|
||||
-Dgradle.user.home="$RUNNER_TEMP/flatpak-gradle-home" \
|
||||
:desktopApp:packageUberJarForCurrentOS :captureFlatpakSources
|
||||
cp build/flatpak-sources.json flatpak-sources.json
|
||||
echo "### Flatpak Sources Summary" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "- URLs captured: $(jq length flatpak-sources.json)" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: flatpak-sources
|
||||
path: flatpak-sources.json
|
||||
|
||||
build-flatpak:
|
||||
needs: generate-sources
|
||||
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86_64, aarch64]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: flatpak-sources
|
||||
|
||||
- name: Clone vid's flatpak repo
|
||||
run: |
|
||||
git clone --depth 1 --recurse-submodules \
|
||||
https://github.com/vidplace7/org.meshtastic.desktop.git \
|
||||
"$RUNNER_TEMP/org.meshtastic.desktop"
|
||||
|
||||
- name: Wire overlay manifest + sources
|
||||
run: |
|
||||
cp scripts/verify-flatpak/desktop-offline.yaml \
|
||||
"$RUNNER_TEMP/org.meshtastic.desktop/org.meshtastic.desktop.yaml"
|
||||
cp flatpak-sources.json \
|
||||
"$RUNNER_TEMP/org.meshtastic.desktop/flatpak-sources.json"
|
||||
rsync -a --delete \
|
||||
--exclude='/build/' --exclude='/.gradle/' \
|
||||
--exclude='*/build/' --exclude='*/.gradle/' \
|
||||
--exclude='/.idea/' --exclude='/local.properties' \
|
||||
./ "$RUNNER_TEMP/org.meshtastic.desktop/meshtastic-android/"
|
||||
|
||||
- name: Install flatpak-builder
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq flatpak flatpak-builder
|
||||
flatpak remote-add --user --if-not-exists flathub \
|
||||
https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
- name: Build flatpak offline
|
||||
working-directory: ${{ runner.temp }}/org.meshtastic.desktop
|
||||
run: |
|
||||
flatpak-builder --user --repo=repo --install-deps-from=flathub \
|
||||
--force-clean builddir org.meshtastic.desktop.yaml
|
||||
|
||||
- name: Export .flatpak bundle
|
||||
working-directory: ${{ runner.temp }}/org.meshtastic.desktop
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
flatpak build-bundle repo org.meshtastic.desktop.${ARCH}.flatpak \
|
||||
org.meshtastic.desktop \
|
||||
--runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||
echo "### ✅ Offline Flatpak build succeeded ($ARCH)" >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: meshtastic-desktop-flatpak-${{ matrix.arch }}
|
||||
path: ${{ runner.temp }}/org.meshtastic.desktop/org.meshtastic.desktop.${{ matrix.arch }}.flatpak
|
||||
Reference in new issue
Block a user