Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions .fdroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@ RepoType: git
Repo: https://github.com/andre487/AndroidMegaProxy.git

Builds:
- versionName: 0.0.4
versionCode: 4
commit: v0.0.4
- versionName: 0.0.5
versionCode: 5
commit: v0.0.5
subdir: app
ndk: 29.0.14206865
sudo:
- apt-get update
- apt-get install -t bookworm-backports -y golang-go
- apt-get install -t trixie-backports -y golang-go
- apt-get install -y gcc libc-dev make
gradle:
- yes
srclibs:
- go@go1.26.3
rm:
- libs/megaproxy-sources.jar
binary: https://github.com/andre487/AndroidMegaProxy/releases/download/v%v/mega-proxy-universal.apk
build:
- pushd $$go$$/src
Expand All @@ -34,14 +32,9 @@ Builds:
- export GOROOT=$$go$$
- export GOPATH=$HOME/go
- export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
- cd ../native
- go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20260821190718-4776eadac327
- go install golang.org/x/mobile/cmd/gobind@v0.0.0-20260821190718-4776eadac327
- gomobile init
- gomobile bind -target=android -androidapi 26 -trimpath -ldflags='-s -w -buildid='
-o ../app/libs/megaproxy.aar ./mobile
- ../scripts/build-fdroid-native.sh

AutoUpdateMode: Version
UpdateCheckMode: Tags
CurrentVersion: 0.0.4
CurrentVersionCode: 4
CurrentVersion: 0.0.5
CurrentVersionCode: 5
21 changes: 4 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,8 @@ jobs:
"ndk;29.0.14206865"
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/29.0.14206865" >> "$GITHUB_ENV"

- name: Install gomobile
run: |
go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20260821190718-4776eadac327
gomobile init

- name: Build arm64 Android AAR
working-directory: native
run: |
mkdir -p ../app/libs
gomobile bind \
-target=android/arm64 \
-androidapi 26 \
-trimpath \
-o ../app/libs/megaproxy.aar \
./mobile
- name: Build native library using the F-Droid recipe
run: ./scripts/build-fdroid-native.sh

- name: Run Android unit tests, lint, and debug build
run: ./gradlew --no-daemon testDebugUnitTest lintDebug assembleDebug
- name: Run Android tests, checks, and clean-store builds
run: ./gradlew --no-daemon testDebugUnitTest lintDebug assembleDebug assembleRelease
35 changes: 35 additions & 0 deletions .github/workflows/fdroid-recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: F-Droid recipe

on:
push:
branches:
- main
paths:
- .fdroid.yml
- app/build.gradle.kts
- native/**
- scripts/build-fdroid-native.sh
- scripts/check-fdroid-metadata-sync.sh
- .github/workflows/fdroid-recipe.yml
schedule:
- cron: "17 6 * * 1"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: fdroid-recipe-${{ github.ref }}
cancel-in-progress: true

jobs:
metadata-sync:
name: Check fdroiddata synchronization
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Compare the recipe with fdroiddata
run: ./scripts/check-fdroid-metadata-sync.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle/
.kotlin/
.idea/
local.properties
**/build/
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ android {
applicationId = "net.megaproxy487"
minSdk = 26
targetSdk = 35
versionCode = 4
versionName = "0.0.4"
versionCode = 5
versionName = "0.0.5"
buildConfigField("String", "GIT_COMMIT_HASH", "\"$gitCommitHash\"")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Make the F-Droid build recipe easier to maintain and verify.

GitHub Actions now exercises the same native release build path, while a scheduled check reports when fdroiddata needs to be updated.
3 changes: 3 additions & 0 deletions fastlane/metadata/android/ru-RU/changelogs/5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Упрощена поддержка и проверка рецепта сборки F-Droid.

GitHub Actions теперь проверяет тот же путь сборки нативной release-библиотеки, а плановая проверка сообщает, когда требуется обновить fdroiddata.
26 changes: 26 additions & 0 deletions scripts/build-fdroid-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -euo pipefail

script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
project_dir="$(cd -- "$script_dir/.." && pwd)"
gomobile_version="v0.0.0-20260821190718-4776eadac327"

: "${ANDROID_HOME:?ANDROID_HOME must point to the Android SDK}"

export GOPATH="${GOPATH:-$HOME/go}"
export PATH="${GOROOT:+$GOROOT/bin:}$GOPATH/bin:$PATH"

go install "golang.org/x/mobile/cmd/gomobile@$gomobile_version"
go install "golang.org/x/mobile/cmd/gobind@$gomobile_version"
gomobile init

mkdir -p "$project_dir/app/libs"
cd "$project_dir/native"
gomobile bind \
-target=android \
-androidapi 26 \
-trimpath \
-ldflags='-s -w -buildid=' \
-o "$project_dir/app/libs/megaproxy.aar" \
./mobile
41 changes: 41 additions & 0 deletions scripts/check-fdroid-metadata-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set -euo pipefail

script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
project_dir="$(cd -- "$script_dir/.." && pwd)"
local_metadata="$project_dir/.fdroid.yml"
temporary_metadata="$(mktemp)"
trap 'rm -f "$temporary_metadata"' EXIT

upstream_url="https://gitlab.com/fdroid/fdroiddata/-/raw/master/metadata/net.megaproxy487.yml"
pending_url="https://gitlab.com/andre487/fdroiddata/-/raw/net.megaproxy487/metadata/net.megaproxy487.yml"

if curl --fail --silent --show-error --location "$upstream_url" > "$temporary_metadata"; then
metadata_url="$upstream_url"
elif curl --fail --silent --show-error --location "$pending_url" > "$temporary_metadata"; then
metadata_url="$pending_url"
else
echo "Unable to download MegaProxy metadata from fdroiddata or its pending fork." >&2
exit 1
fi

ruby -ryaml -e '
keys = %w[
AllowedAPKSigningKeys Builds AutoUpdateMode UpdateCheckMode
CurrentVersion CurrentVersionCode
]
local = YAML.safe_load(File.read(ARGV[0]), permitted_classes: [], aliases: false)
remote = YAML.safe_load(File.read(ARGV[1]), permitted_classes: [], aliases: false)
local_recipe = local.select { |key, _| keys.include?(key) }
remote_recipe = remote.select { |key, _| keys.include?(key) }
exit 0 if local_recipe == remote_recipe

warn "The F-Droid recipe is out of sync with #{ARGV[2]}."
warn "Update metadata/net.megaproxy487.yml in fdroiddata after merging the app change."
warn "Local recipe: #{local_recipe.inspect}"
warn "Remote recipe: #{remote_recipe.inspect}"
exit 1
' "$local_metadata" "$temporary_metadata" "$metadata_url"

echo "F-Droid metadata matches $metadata_url"