fix
Build Futon with Niadd patch / Build Futon Niadd debug APK (push) Failing after 9m29s

This commit is contained in:
2026-08-09 21:58:45 +03:00
parent 50ef467ac3
commit f09a471694
2 changed files with 321 additions and 15 deletions
+231 -15
View File
@@ -12,12 +12,16 @@ on:
env:
FUTON_REPOSITORY: "https://github.com/AppFuton/Futon.git"
FUTON_REF: "devel"
PARSERS_REPOSITORY: "https://github.com/Kotatsu-Redo/kotatsu-parsers-redo.git"
PARSERS_REF: "master"
ANDROID_PLATFORM: "36"
ANDROID_BUILD_TOOLS: "36.0.0"
jobs:
build:
name: Build debug APK
name: Build Futon Niadd debug APK
runs-on: ubuntu-latest
steps:
@@ -37,7 +41,41 @@ jobs:
shell: bash
run: |
set -euxo pipefail
sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"
yes | sdkmanager --licenses >/dev/null 2>&1 || true
sdkmanager \
"platform-tools" \
"platforms;android-${ANDROID_PLATFORM}" \
"build-tools;${ANDROID_BUILD_TOOLS}"
echo "=== Android SDK ==="
echo "ANDROID_HOME=${ANDROID_HOME}"
echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT:-}"
echo "=== Installed build tools ==="
ls -la "${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}"
echo "=== Java ==="
java -version
echo "=== Python ==="
python3 --version
echo "=== Git ==="
git --version
- name: Verify patch scripts
shell: bash
run: |
set -euxo pipefail
test -f scripts/patch_futon_niadd.py
test -f scripts/patch_ninemanga_niadd.py
python3 -m py_compile \
scripts/patch_futon_niadd.py \
scripts/patch_ninemanga_niadd.py
- name: Clone upstream repositories
shell: bash
@@ -59,9 +97,53 @@ jobs:
"${PARSERS_REPOSITORY}" \
work/kotatsu-parsers-redo
echo "=== Futon upstream ==="
git -C work/Futon remote -v
git -C work/Futon rev-parse HEAD
echo "=== Parsers upstream ==="
git -C work/kotatsu-parsers-redo remote -v
git -C work/kotatsu-parsers-redo rev-parse HEAD
- name: Configure standalone Futon Niadd variant
shell: bash
run: |
set -euxo pipefail
python3 scripts/patch_futon_niadd.py \
work/Futon
echo "=== Verify Futon build.gradle modification ==="
grep -F "applicationIdSuffix = '.niadd'" \
work/Futon/app/build.gradle
echo "=== Verify Niadd resource overlay ==="
NIADD_RESOURCES="work/Futon/app/src/debug/res/values/niadd.xml"
test -f "${NIADD_RESOURCES}"
grep -F "Futon Niadd" \
"${NIADD_RESOURCES}"
grep -F "io.github.landwarderer.futon.niadd.sync" \
"${NIADD_RESOURCES}"
grep -F "io.github.landwarderer.futon.niadd.history" \
"${NIADD_RESOURCES}"
grep -F "io.github.landwarderer.futon.niadd.favourites" \
"${NIADD_RESOURCES}"
echo "=== Futon resulting diff ==="
git -C work/Futon diff -- \
app/build.gradle \
app/src/debug/res/values/niadd.xml
git -C work/Futon diff --check
- name: Apply Niadd parser modifications
shell: bash
run: |
@@ -72,25 +154,49 @@ jobs:
PARSER_FILE="work/kotatsu-parsers-redo/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineMangaParser.kt"
test -f "${PARSER_FILE}"
echo "=== Verify Niadd domain ==="
grep -F '"ru.niadd.com"' "${PARSER_FILE}"
grep -F '"ru.niadd.com"' \
"${PARSER_FILE}"
echo "=== Verify source annotation ==="
grep -F '@MangaSourceParser("NINEMANGA_RU", "Niadd Русский", "ru")' "${PARSER_FILE}"
grep -F '@MangaSourceParser("NINEMANGA_RU", "Niadd Русский", "ru")' \
"${PARSER_FILE}"
echo "=== Verify Niadd pagination ==="
grep -F 'domain.endsWith("niadd.com")' "${PARSER_FILE}"
grep -F 'domain.endsWith("niadd.com")' \
"${PARSER_FILE}"
grep -F 'append(".html")' \
"${PARSER_FILE}"
echo "=== Ensure old Russian domain is gone ==="
if grep -F '"ru.ninemanga.com"' "${PARSER_FILE}"; then
echo "ERROR: old ru.ninemanga.com domain is still present"
exit 1
fi
echo "=== Resulting diff ==="
echo "=== Ensure Russian source is no longer marked Broken ==="
if grep -B1 \
'@MangaSourceParser("NINEMANGA_RU", "Niadd Русский", "ru")' \
"${PARSER_FILE}" | grep -F '@Broken'; then
echo "ERROR: Niadd Russian source is still marked @Broken"
exit 1
fi
echo "=== Parsers resulting diff ==="
git -C work/kotatsu-parsers-redo diff -- \
src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineMangaParser.kt
git -C work/kotatsu-parsers-redo diff --check
- name: Connect Futon to patched local parsers
shell: bash
run: |
@@ -99,8 +205,8 @@ jobs:
cat >> work/Futon/settings.gradle <<'EOF'
// Added by futon-niadd-gitea-ci.
// Replace the JitPack kotatsu-parsers-redo dependency with the
// patched source tree cloned next to Futon.
// Replace the JitPack kotatsu-parsers-redo dependency
// with the patched local parser source tree.
includeBuild('../kotatsu-parsers-redo') {
dependencySubstitution {
substitute module('com.github.clquwu:kotatsu-parsers-redo') using project(':')
@@ -108,37 +214,138 @@ jobs:
}
EOF
tail -n 12 work/Futon/settings.gradle
echo "=== Resulting settings.gradle tail ==="
tail -n 20 work/Futon/settings.gradle
- name: Build Futon debug APK
grep -F "includeBuild('../kotatsu-parsers-redo')" \
work/Futon/settings.gradle
grep -F "com.github.clquwu:kotatsu-parsers-redo" \
work/Futon/settings.gradle
- name: Build Futon Niadd debug APK
shell: bash
working-directory: work/Futon
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx4g"
GRADLE_OPTS: >-
-Dorg.gradle.daemon=false
-Dorg.gradle.jvmargs=-Xmx4g
run: |
set -euxo pipefail
chmod +x gradlew
echo "=== Gradle version ==="
./gradlew --version
echo "=== Build ==="
./gradlew \
--no-daemon \
--stacktrace \
:app:assembleDebug
- name: Verify APK identity
shell: bash
run: |
set -euxo pipefail
APK="work/Futon/app/build/outputs/apk/debug/app-debug.apk"
test -s "${APK}"
AAPT="${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/aapt"
AAPT2="${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/aapt2"
test -x "${AAPT}"
test -x "${AAPT2}"
echo "=== APK file ==="
ls -lh "${APK}"
echo "=== APK badging ==="
"${AAPT}" dump badging "${APK}" | head -n 30
echo "=== Verify package name ==="
PACKAGE_INFO="$(
"${AAPT}" dump badging "${APK}" |
grep '^package:'
)"
echo "${PACKAGE_INFO}"
echo "${PACKAGE_INFO}" |
grep -F "name='io.github.landwarderer.futon.niadd'"
echo "=== Ensure original Futon package is NOT used ==="
if echo "${PACKAGE_INFO}" |
grep -F "name='io.github.landwarderer.futon'"; then
echo "ERROR: APK uses the original Futon applicationId"
exit 1
fi
echo "=== Verify application label ==="
APP_LABEL="$(
"${AAPT}" dump badging "${APK}" |
grep '^application-label:'
)"
echo "${APP_LABEL}"
echo "${APP_LABEL}" |
grep -F "application-label:'Futon Niadd'"
echo "=== Verify compiled Niadd resource values ==="
"${AAPT2}" dump resources "${APK}" \
> /tmp/futon-niadd-resources.txt
grep -F "io.github.landwarderer.futon.niadd.sync" \
/tmp/futon-niadd-resources.txt
grep -F "io.github.landwarderer.futon.niadd.history" \
/tmp/futon-niadd-resources.txt
grep -F "io.github.landwarderer.futon.niadd.favourites" \
/tmp/futon-niadd-resources.txt
echo "=== APK identity verification successful ==="
- name: Prepare build artifacts
shell: bash
run: |
set -euxo pipefail
APK="work/Futon/app/build/outputs/apk/debug/app-debug.apk"
test -s "${APK}"
rm -rf dist
mkdir -p dist
cp "${APK}" dist/Futon-Niadd-debug.apk
FUTON_SHA="$(git -C work/Futon rev-parse HEAD)"
PARSERS_SHA="$(git -C work/kotatsu-parsers-redo rev-parse HEAD)"
cp \
"${APK}" \
dist/Futon-Niadd-debug.apk
FUTON_SHA="$(
git -C work/Futon rev-parse HEAD
)"
PARSERS_SHA="$(
git -C work/kotatsu-parsers-redo rev-parse HEAD
)"
{
echo "Build: Futon Niadd"
echo
echo "Application ID: io.github.landwarderer.futon.niadd"
echo "Application name: Futon Niadd"
echo
echo "Futon repository: ${FUTON_REPOSITORY}"
echo "Futon ref: ${FUTON_REF}"
echo "Futon commit: ${FUTON_SHA}"
@@ -147,6 +354,10 @@ jobs:
echo "Parsers ref: ${PARSERS_REF}"
echo "Parsers commit: ${PARSERS_SHA}"
echo
echo "Android platform: ${ANDROID_PLATFORM}"
echo "Android build tools: ${ANDROID_BUILD_TOOLS}"
echo
echo "Java:"
java -version 2>&1
} > dist/build-info.txt
@@ -155,12 +366,17 @@ jobs:
sha256sum Futon-Niadd-debug.apk > SHA256SUMS
)
echo "=== Build artifacts ==="
ls -lh dist
echo "=== SHA256 ==="
cat dist/SHA256SUMS
echo "=== Build info ==="
cat dist/build-info.txt
- name: Upload APK
uses: https://github.com/actions/upload-artifact@v3
uses: https://github.com/actions/upload-artifact@v3.2.2-node20
with:
name: Futon-Niadd-debug
path: dist/
+90
View File
@@ -0,0 +1,90 @@
#!/usr/bin/env python3
from pathlib import Path
import sys
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} <Futon-dir>", file=sys.stderr)
sys.exit(2)
repo_dir = Path(sys.argv[1]).resolve()
build_gradle = repo_dir / "app/build.gradle"
if not build_gradle.is_file():
print(f"ERROR: build.gradle not found: {build_gradle}", file=sys.stderr)
sys.exit(1)
text = build_gradle.read_text(encoding="utf-8")
def replace_exact(name: str, old: str, new: str) -> None:
global text
count = text.count(old)
if count != 1:
print(
f"ERROR: modification '{name}' expected exactly 1 match, found {count}",
file=sys.stderr,
)
print(
"Upstream Futon build.gradle has probably changed.",
file=sys.stderr,
)
sys.exit(1)
text = text.replace(old, new, 1)
print(f"[OK] {name}")
replace_exact(
"Niadd applicationId suffix",
"""\t\tdebug {
\t\t\tapplicationIdSuffix = '.debug'
\t\t\tbuildConfigField "String", "SENTRY_DSN", '""'
\t\t}
""",
"""\t\tdebug {
\t\t\tapplicationIdSuffix = '.niadd'
\t\t\tversionNameSuffix = '-Niadd'
\t\t\tbuildConfigField "String", "SENTRY_DSN", '""'
\t\t}
""",
)
build_gradle.write_text(text, encoding="utf-8")
values_dir = repo_dir / "app/src/debug/res/values"
values_dir.mkdir(parents=True, exist_ok=True)
niadd_resources = values_dir / "niadd.xml"
niadd_resources.write_text(
"""<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Futon Niadd</string>
<string name="account_type_sync" translatable="false">io.github.landwarderer.futon.niadd.sync</string>
<string name="sync_authority_history" translatable="false">io.github.landwarderer.futon.niadd.history</string>
<string name="sync_authority_favourites" translatable="false">io.github.landwarderer.futon.niadd.favourites</string>
</resources>
""",
encoding="utf-8",
)
print()
print("[OK] Futon Niadd application variant configured")
print("[OK] applicationId: io.github.landwarderer.futon.niadd")
print("[OK] app name: Futon Niadd")
print("[OK] account type: io.github.landwarderer.futon.niadd.sync")
print("[OK] history authority: io.github.landwarderer.futon.niadd.history")
print("[OK] favourites authority: io.github.landwarderer.futon.niadd.favourites")