169 lines
4.7 KiB
YAML
169 lines
4.7 KiB
YAML
name: Build Futon with Niadd patch
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- ".gitea/workflows/build.yml"
|
|
- "scripts/**"
|
|
workflow_dispatch:
|
|
|
|
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"
|
|
|
|
jobs:
|
|
build:
|
|
name: Build debug APK
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout CI repository
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Set up JDK 17
|
|
uses: https://github.com/actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
|
|
- name: Set up Android SDK
|
|
uses: https://github.com/android-actions/setup-android@v3
|
|
|
|
- name: Install Android SDK 36
|
|
shell: bash
|
|
run: |
|
|
set -euxo pipefail
|
|
sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"
|
|
|
|
- name: Clone upstream repositories
|
|
shell: bash
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
rm -rf work
|
|
mkdir -p work
|
|
|
|
git clone \
|
|
--depth 1 \
|
|
--branch "${FUTON_REF}" \
|
|
"${FUTON_REPOSITORY}" \
|
|
work/Futon
|
|
|
|
git clone \
|
|
--depth 1 \
|
|
--branch "${PARSERS_REF}" \
|
|
"${PARSERS_REPOSITORY}" \
|
|
work/kotatsu-parsers-redo
|
|
|
|
git -C work/Futon rev-parse HEAD
|
|
git -C work/kotatsu-parsers-redo rev-parse HEAD
|
|
|
|
- name: Apply Niadd parser modifications
|
|
shell: bash
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
python3 scripts/patch_ninemanga_niadd.py \
|
|
work/kotatsu-parsers-redo
|
|
|
|
PARSER_FILE="work/kotatsu-parsers-redo/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineMangaParser.kt"
|
|
|
|
echo "=== Verify Niadd domain ==="
|
|
grep -F '"ru.niadd.com"' "${PARSER_FILE}"
|
|
|
|
echo "=== Verify source annotation ==="
|
|
grep -F '@MangaSourceParser("NINEMANGA_RU", "Niadd Русский", "ru")' "${PARSER_FILE}"
|
|
|
|
echo "=== Verify Niadd pagination ==="
|
|
grep -F 'domain.endsWith("niadd.com")' "${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 ==="
|
|
git -C work/kotatsu-parsers-redo diff -- \
|
|
src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/NineMangaParser.kt
|
|
|
|
- name: Connect Futon to patched local parsers
|
|
shell: bash
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
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.
|
|
includeBuild('../kotatsu-parsers-redo') {
|
|
dependencySubstitution {
|
|
substitute module('com.github.clquwu:kotatsu-parsers-redo') using project(':')
|
|
}
|
|
}
|
|
EOF
|
|
|
|
tail -n 12 work/Futon/settings.gradle
|
|
|
|
- name: Build Futon debug APK
|
|
shell: bash
|
|
working-directory: work/Futon
|
|
env:
|
|
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx4g"
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
chmod +x gradlew
|
|
./gradlew \
|
|
--no-daemon \
|
|
--stacktrace \
|
|
:app:assembleDebug
|
|
|
|
- name: Prepare build artifacts
|
|
shell: bash
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
APK="work/Futon/app/build/outputs/apk/debug/app-debug.apk"
|
|
test -s "${APK}"
|
|
|
|
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)"
|
|
|
|
{
|
|
echo "Futon repository: ${FUTON_REPOSITORY}"
|
|
echo "Futon ref: ${FUTON_REF}"
|
|
echo "Futon commit: ${FUTON_SHA}"
|
|
echo
|
|
echo "Parsers repository: ${PARSERS_REPOSITORY}"
|
|
echo "Parsers ref: ${PARSERS_REF}"
|
|
echo "Parsers commit: ${PARSERS_SHA}"
|
|
echo
|
|
java -version 2>&1
|
|
} > dist/build-info.txt
|
|
|
|
(
|
|
cd dist
|
|
sha256sum Futon-Niadd-debug.apk > SHA256SUMS
|
|
)
|
|
|
|
ls -lh dist
|
|
cat dist/SHA256SUMS
|
|
cat dist/build-info.txt
|
|
|
|
- name: Upload APK
|
|
uses: https://github.com/actions/upload-artifact@v3
|
|
with:
|
|
name: Futon-Niadd-debug
|
|
path: dist/
|
|
if-no-files-found: error
|
|
retention-days: 30
|