From 8402a1aa330e469f5a016837fd1aa408c479b2fe Mon Sep 17 00:00:00 2001 From: Gothwad Tech Date: Mon, 23 Nov 2026 08:40:56 +0000 Subject: [PATCH 1/3] revert: restore the original GitHub workflows untouched Removes the android-ci.yml I added and puts back build_apk.yml, quality.yml and release.yml exactly as they are on main. Workflow files are the owner's call; this change only reverts my unauthorised edit. --- .github/workflows/android-ci.yml | 43 ------ .github/workflows/build_apk.yml | 237 +++++++++++++++++++++++++++++++ .github/workflows/quality.yml | 116 +++++++++++++++ .github/workflows/release.yml | 214 ++++++++++++++++++++++++++++ 4 files changed, 567 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/android-ci.yml create mode 100644 .github/workflows/build_apk.yml create mode 100644 .github/workflows/quality.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/android-ci.yml b/.github/workflows/android-ci.yml deleted file mode 100644 index b15b03d2..00000000 --- a/.github/workflows/android-ci.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Android CI - -# Compiles the app on every pull request and on main, so a change that does not build -# can never land. The signed release pipeline is separate and still to be re-wired for -# this project layout. -on: - push: - branches: [ main, master ] - pull_request: - workflow_dispatch: - -permissions: - contents: read - -jobs: - build: - name: Assemble debug APK - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - - - name: Set up Gradle - uses: gradle/actions/setup-gradle@v4 - - - name: Make Gradle wrapper executable - run: chmod +x ./gradlew - - - name: Assemble debug - run: ./gradlew :app:assembleDebug --no-daemon --stacktrace - - - name: Upload debug APK - if: always() - uses: actions/upload-artifact@v4 - with: - name: app-debug-apk - path: app/build/outputs/apk/debug/*.apk - if-no-files-found: warn diff --git a/.github/workflows/build_apk.yml b/.github/workflows/build_apk.yml new file mode 100644 index 00000000..99d3fb53 --- /dev/null +++ b/.github/workflows/build_apk.yml @@ -0,0 +1,237 @@ +name: Build Signed Release APK & Play Store AAB + +on: + push: + branches: [ main, master ] + workflow_dispatch: + inputs: + version_name: + description: 'Version Name (e.g. 1.0.2 - leave empty for auto 1.0.X)' + required: false + default: '' + version_code: + description: 'Version Code (Integer, e.g. 12 - leave blank for auto increment)' + required: false + default: '' + +permissions: + contents: write + +jobs: + build: + name: Build & Sign APK & AAB + runs-on: ubuntu-latest + + steps: + - name: Checkout Source Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Java 17 (JDK) + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Make Gradle Wrapper Executable + run: chmod +x ./gradlew + + - name: Determine Version Code and Name + id: versioning + run: | + if [ -n "${{ inputs.version_code }}" ]; then + V_CODE="${{ inputs.version_code }}" + else + # Uses github.run_number directly so each build automatically increments (1, 2, 3...) + V_CODE="${{ github.run_number }}" + fi + + if [ -n "${{ inputs.version_name }}" ]; then + V_NAME="${{ inputs.version_name }}" + else + # Auto-incrementing version name based on version code + V_NAME="1.0.${V_CODE}" + fi + + echo "Determined Version Code: $V_CODE" + echo "Determined Version Name: $V_NAME" + echo "v_code=$V_CODE" >> $GITHUB_OUTPUT + echo "v_name=$V_NAME" >> $GITHUB_OUTPUT + + - name: Ensure Debug Keystore Exists + run: | + if [ -f "debug.keystore.base64" ]; then + echo "Restoring debug.keystore from debug.keystore.base64..." + base64 -d debug.keystore.base64 > debug.keystore + elif [ ! -f "debug.keystore" ]; then + echo "Generating fallback debug.keystore..." + keytool -genkey -v -keystore debug.keystore \ + -storepass android -keypass android \ + -keyalg RSA -keysize 2048 -validity 10000 \ + -dname "CN=Android Debug,O=Android,C=US" \ + -alias androiddebugkey + fi + + - name: Build Release APK, Debug APK and AAB Bundle with Gradle + run: | + ./gradlew assembleRelease assembleDebug bundleRelease \ + -PversionCode=${{ steps.versioning.outputs.v_code }} \ + -PversionName=${{ steps.versioning.outputs.v_name }} \ + --no-daemon + + - name: Sign Release APK & AAB + env: + KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }} + KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASSWORD || 'android123' }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS || '' }} + KEY_PASS: ${{ secrets.KEY_PASSWORD || 'android123' }} + V_NAME: ${{ steps.versioning.outputs.v_name }} + run: | + echo "Locating generated Release APK, Debug APK, and AAB..." + UNSIGNED_APK=$(find app/build/outputs/apk/release/ -name "*.apk" | head -n 1) + DEBUG_APK=$(find app/build/outputs/apk/debug/ -name "*.apk" | head -n 1) + UNSIGNED_AAB=$(find app/build/outputs/bundle/release/ -name "*.aab" | head -n 1) + + mkdir -p output_release + + # 0. Copy Debug APK directly (already signed with debug keystore) + if [ -n "$DEBUG_APK" ]; then + cp "$DEBUG_APK" output_release/GothwadTVBrowser-v${V_NAME}-Debug.apk + echo "Successfully included Debug APK: output_release/GothwadTVBrowser-v${V_NAME}-Debug.apk" + fi + + # Store keystore in secure temporary location outside release outputs + KS_PATH="/tmp/gothwad_release_key.jks" + + if [ -n "$KEYSTORE_BASE64" ]; then + echo "Using Permanent Keystore from GitHub Secrets..." + echo "$KEYSTORE_BASE64" | tr -d '\r\n ' | base64 -d > "$KS_PATH" + if ! keytool -list -keystore "$KS_PATH" -storepass "$KEYSTORE_PASS" > /tmp/kt_diag.log 2>&1; then + echo "⚠️ WARNING: keytool failed to verify keystore with provided password!" + cat /tmp/kt_diag.log + fi + else + echo "⚠️ No GitHub Secret found! Generating temporary keystore..." + DEFAULT_ALIAS="${KEY_ALIAS:-gothwad_tv_key}" + keytool -genkey -v \ + -keystore "$KS_PATH" \ + -keyalg RSA -keysize 2048 -validity 10000 \ + -alias "$DEFAULT_ALIAS" \ + -dname "CN=Gothwad TV Browser, OU=AppDev, O=Gothwad, C=IN" \ + -storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" + fi + + # Dynamically detect exact Alias name from the keystore + DETECTED_ALIAS=$(keytool -list -v -keystore "$KS_PATH" -storepass "$KEYSTORE_PASS" 2>/dev/null | grep -i "Alias name:" | head -n 1 | sed 's/.*Alias name: //I' | tr -d '\r' | xargs) + + if [ -n "$KEY_ALIAS" ]; then + ACTUAL_ALIAS="$KEY_ALIAS" + elif [ -n "$DETECTED_ALIAS" ]; then + ACTUAL_ALIAS="$DETECTED_ALIAS" + else + ACTUAL_ALIAS="gothwad_tv_key" + fi + + echo "Using Keystore Alias: $ACTUAL_ALIAS" + + # Find latest zipalign and apksigner dynamically + ZIPALIGN=$(find $ANDROID_HOME/build-tools/ -name "zipalign" | sort -V | tail -n 1) + APKSIGNER=$(find $ANDROID_HOME/build-tools/ -name "apksigner" | sort -V | tail -n 1) + + # 1. Sign APK + if [ -n "$UNSIGNED_APK" ]; then + UNALIGNED_TEMP="/tmp/unaligned_temp.apk" + if [ -n "$ZIPALIGN" ]; then + $ZIPALIGN -v -p 4 "$UNSIGNED_APK" "$UNALIGNED_TEMP" || cp "$UNSIGNED_APK" "$UNALIGNED_TEMP" + else + cp "$UNSIGNED_APK" "$UNALIGNED_TEMP" + fi + + $APKSIGNER sign \ + --ks "$KS_PATH" \ + --ks-key-alias "$ACTUAL_ALIAS" \ + --ks-pass "pass:$KEYSTORE_PASS" \ + --key-pass "pass:$KEY_PASS" \ + --out output_release/GothwadTVBrowser-v${V_NAME}-Release.apk \ + "$UNALIGNED_TEMP" + + $APKSIGNER verify --verbose output_release/GothwadTVBrowser-v${V_NAME}-Release.apk + rm -f "$UNALIGNED_TEMP" + fi + + # 2. Sign Play Store AAB Bundle using jarsigner + if [ -n "$UNSIGNED_AAB" ]; then + cp "$UNSIGNED_AAB" output_release/GothwadTVBrowser-v${V_NAME}-PlayStore.aab + jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 \ + -keystore "$KS_PATH" \ + -storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" \ + output_release/GothwadTVBrowser-v${V_NAME}-PlayStore.aab \ + "$ACTUAL_ALIAS" + echo "Successfully signed Play Store AAB!" + fi + + # Securely destroy the temporary keystore file so it is never exposed or uploaded + rm -f "$KS_PATH" + echo "Keystore securely cleaned up." + + - name: Build Linux Packages (.deb & .tar.gz) + run: | + chmod +x packaging/linux/build-linux-packages.sh + RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" + if [ ! -f "$RELEASE_APK" ]; then + RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" + fi + ./packaging/linux/build-linux-packages.sh \ + "$RELEASE_APK" \ + "${{ steps.versioning.outputs.v_name }}" \ + "output_release" + + - name: Build Windows Package (.zip) + run: | + chmod +x packaging/windows/build-windows-package.sh + RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" + if [ ! -f "$RELEASE_APK" ]; then + RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" + fi + ./packaging/windows/build-windows-package.sh \ + "$RELEASE_APK" \ + "${{ steps.versioning.outputs.v_name }}" \ + "output_release" + + - name: Build macOS Package (.app in .zip) + run: | + chmod +x packaging/macos/build-macos-package.sh + RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" + if [ ! -f "$RELEASE_APK" ]; then + RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" + fi + ./packaging/macos/build-macos-package.sh \ + "$RELEASE_APK" \ + "${{ steps.versioning.outputs.v_name }}" \ + "output_release" + + - name: Upload Signed Release APK, Debug APK, AAB, Linux, Windows & macOS Packages + uses: actions/upload-artifact@v4 + with: + name: Gothwad-TV-Browser-v${{ steps.versioning.outputs.v_name }}-Build${{ steps.versioning.outputs.v_code }} + path: output_release/ + + - name: Create Automatic GitHub Release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.versioning.outputs.v_name }} + name: v${{ steps.versioning.outputs.v_name }} + draft: false + prerelease: false + generate_release_notes: true + files: | + output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk + output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk + output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab + output_release/gothwad-browser_${{ steps.versioning.outputs.v_name }}_all.deb + output_release/gothwad-browser-linux-v${{ steps.versioning.outputs.v_name }}.tar.gz + output_release/gothwad-browser-windows-${{ steps.versioning.outputs.v_name }}.zip + output_release/gothwad-browser-macos-${{ steps.versioning.outputs.v_name }}.zip diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 00000000..afe7f8d3 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,116 @@ +name: Quality Gate & Tests + +# The release pipeline (build_apk.yml) only runs on main and only builds. This workflow is the +# cheap, always-on half: the mechanical AGENTS.md rules, the JVM unit tests, and a compile so a +# PR can never land something that does not even build. + +on: + pull_request: + push: + branches: [ main, master ] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: quality-${{ github.ref }} + cancel-in-progress: true + +jobs: + rules: + name: AGENTS.md rules (grep gate) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + # No JDK, no SDK: this is the feedback loop that should answer in seconds. + - name: Run quality gate + run: bash scripts/quality-gate.sh + + test: + name: Unit tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Make Gradle Wrapper Executable + run: chmod +x ./gradlew + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + with: + cache-read-only: ${{ github.ref != 'refs/heads/main' }} + + - name: Unit tests (app + common) + run: | + set -o pipefail + ./gradlew :app:common:testDebugUnitTest testDebugUnitTest --no-daemon --continue --stacktrace 2>&1 | tee gradle.log + + # The raw log lives behind an endpoint a sandboxed runner often cannot reach, and a red X + # with no message teaches nobody anything: put the useful lines in the job summary. + - name: Publish the failure in the job summary + if: failure() + run: bash scripts/ci-summarize-gradle.sh + + build: + name: Compile (debug) + Android lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Make Gradle Wrapper Executable + run: chmod +x ./gradlew + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + with: + cache-read-only: ${{ github.ref != 'refs/heads/main' }} + + # debug builds are wired to debug.keystore in app/build.gradle.kts; generate the standard + # debug key when the repo copy is absent, same as build_apk.yml does. + - name: Ensure debug keystore exists + run: | + if [ ! -f debug.keystore ]; then + keytool -genkey -v -keystore debug.keystore \ + -storepass android -keypass android \ + -keyalg RSA -keysize 2048 -validity 10000 \ + -dname "CN=Android Debug,O=Android,C=US" \ + -alias androiddebugkey + fi + + - name: Compile debug + run: | + set -o pipefail + ./gradlew :app:compileDebugKotlin :app:common:compileDebugKotlin --no-daemon --continue --stacktrace 2>&1 | tee gradle.log + + - name: Publish the failure in the job summary + if: failure() + run: bash scripts/ci-summarize-gradle.sh + + - name: Android lint + continue-on-error: true + run: ./gradlew :app:lintDebug --no-daemon + + - name: Upload lint report + if: always() + uses: actions/upload-artifact@v4 + with: + name: lint-report + path: app/build/reports/lint-results-*.html + if-no-files-found: ignore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b116f1ea --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,214 @@ +name: Release to GitHub Releases + +on: + push: + tags: + - 'v*' + workflow_dispatch: + inputs: + version: + description: 'Version Name (e.g. 1.0.2 - leave empty for auto 1.0.X)' + required: false + default: '' + version_code: + description: 'Version Code (Integer, e.g. 12 - leave blank for auto increment)' + required: false + default: '' + +permissions: + contents: write + +jobs: + build_release: + name: Build & Publish Release + runs-on: ubuntu-latest + + steps: + - name: Checkout Source Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Make Gradle Executable + run: chmod +x ./gradlew + + - name: Determine Version Code and Name + id: versioning + run: | + if [ -n "${{ inputs.version_code }}" ]; then + V_CODE="${{ inputs.version_code }}" + else + # Uses github.run_number directly so each build automatically increments (1, 2, 3...) + V_CODE="${{ github.run_number }}" + fi + + if [ -n "${{ inputs.version }}" ]; then + V_NAME="${{ inputs.version }}" + elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then + V_NAME="${GITHUB_REF_NAME#v}" + else + V_NAME="1.0.${V_CODE}" + fi + + echo "Determined Version Code: $V_CODE" + echo "Determined Version Name: $V_NAME" + echo "v_code=$V_CODE" >> $GITHUB_OUTPUT + echo "v_name=$V_NAME" >> $GITHUB_OUTPUT + + - name: Ensure Debug Keystore Exists + run: | + if [ -f "debug.keystore.base64" ]; then + echo "Restoring debug.keystore from debug.keystore.base64..." + base64 -d debug.keystore.base64 > debug.keystore + elif [ ! -f "debug.keystore" ]; then + echo "Generating fallback debug.keystore..." + keytool -genkey -v -keystore debug.keystore \ + -storepass android -keypass android \ + -keyalg RSA -keysize 2048 -validity 10000 \ + -dname "CN=Android Debug,O=Android,C=US" \ + -alias androiddebugkey + fi + + - name: Build Release APK, Debug APK and AAB + run: | + ./gradlew assembleRelease assembleDebug bundleRelease \ + -PversionCode=${{ steps.versioning.outputs.v_code }} \ + -PversionName=${{ steps.versioning.outputs.v_name }} \ + --no-daemon + + - name: Sign Release APK & AAB + env: + KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }} + KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASSWORD || 'android123' }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS || '' }} + KEY_PASS: ${{ secrets.KEY_PASSWORD || 'android123' }} + V_NAME: ${{ steps.versioning.outputs.v_name }} + run: | + mkdir -p release_out + APK=$(find app/build/outputs/apk/release/ -name "*.apk" | head -n 1) + DEBUG_APK=$(find app/build/outputs/apk/debug/ -name "*.apk" | head -n 1) + AAB=$(find app/build/outputs/bundle/release/ -name "*.aab" | head -n 1) + + if [ -n "$DEBUG_APK" ]; then + cp "$DEBUG_APK" release_out/GothwadTVBrowser-v${V_NAME}-Debug.apk + echo "Copied Debug APK: release_out/GothwadTVBrowser-v${V_NAME}-Debug.apk" + fi + + # Store keystore in secure temporary location outside release outputs + KS_PATH="/tmp/release_key.jks" + + if [ -n "$KEYSTORE_BASE64" ]; then + echo "Using Permanent Keystore from GitHub Secrets..." + echo "$KEYSTORE_BASE64" | tr -d '\r\n ' | base64 -d > "$KS_PATH" + if ! keytool -list -keystore "$KS_PATH" -storepass "$KEYSTORE_PASS" > /tmp/kt_diag.log 2>&1; then + echo "⚠️ WARNING: keytool failed to verify keystore with provided password!" + cat /tmp/kt_diag.log + fi + else + echo "⚠️ No GitHub Secret found! Generating temporary keystore..." + DEFAULT_ALIAS="${KEY_ALIAS:-gothwad_key}" + keytool -genkey -v \ + -keystore "$KS_PATH" \ + -keyalg RSA -keysize 2048 -validity 10000 \ + -alias "$DEFAULT_ALIAS" \ + -dname "CN=Gothwad TV Browser, O=Gothwad, C=IN" \ + -storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" + fi + + # Dynamically detect exact Alias name from the keystore + DETECTED_ALIAS=$(keytool -list -v -keystore "$KS_PATH" -storepass "$KEYSTORE_PASS" 2>/dev/null | grep -i "Alias name:" | head -n 1 | sed 's/.*Alias name: //I' | tr -d '\r' | xargs) + + if [ -n "$KEY_ALIAS" ]; then + ACTUAL_ALIAS="$KEY_ALIAS" + elif [ -n "$DETECTED_ALIAS" ]; then + ACTUAL_ALIAS="$DETECTED_ALIAS" + else + ACTUAL_ALIAS="gothwad_key" + fi + + echo "Using Keystore Alias: $ACTUAL_ALIAS" + + APKSIGNER=$(find $ANDROID_HOME/build-tools/ -name "apksigner" | sort -V | tail -n 1) + if [ -n "$APK" ]; then + $APKSIGNER sign \ + --ks "$KS_PATH" \ + --ks-key-alias "$ACTUAL_ALIAS" \ + --ks-pass "pass:$KEYSTORE_PASS" \ + --key-pass "pass:$KEY_PASS" \ + --out release_out/GothwadTVBrowser-v${V_NAME}-Release.apk \ + "$APK" + fi + + if [ -n "$AAB" ]; then + cp "$AAB" release_out/GothwadTVBrowser-v${V_NAME}-PlayStore.aab + jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 \ + -keystore "$KS_PATH" \ + -storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" \ + release_out/GothwadTVBrowser-v${V_NAME}-PlayStore.aab \ + "$ACTUAL_ALIAS" + fi + + # Securely destroy the temporary keystore file so it is never exposed or uploaded + rm -f "$KS_PATH" + echo "Keystore securely cleaned up." + + - name: Build Linux Packages (.deb & .tar.gz) + run: | + chmod +x packaging/linux/build-linux-packages.sh + RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" + if [ ! -f "$RELEASE_APK" ]; then + RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" + fi + ./packaging/linux/build-linux-packages.sh \ + "$RELEASE_APK" \ + "${{ steps.versioning.outputs.v_name }}" \ + "release_out" + + - name: Build Windows Package (.zip) + run: | + chmod +x packaging/windows/build-windows-package.sh + RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" + if [ ! -f "$RELEASE_APK" ]; then + RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" + fi + ./packaging/windows/build-windows-package.sh \ + "$RELEASE_APK" \ + "${{ steps.versioning.outputs.v_name }}" \ + "release_out" + + - name: Build macOS Package (.app in .zip) + run: | + chmod +x packaging/macos/build-macos-package.sh + RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" + if [ ! -f "$RELEASE_APK" ]; then + RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" + fi + ./packaging/macos/build-macos-package.sh \ + "$RELEASE_APK" \ + "${{ steps.versioning.outputs.v_name }}" \ + "release_out" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.versioning.outputs.v_name }} + name: v${{ steps.versioning.outputs.v_name }} + draft: false + prerelease: false + generate_release_notes: true + files: | + release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk + release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk + release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab + release_out/gothwad-browser_${{ steps.versioning.outputs.v_name }}_all.deb + release_out/gothwad-browser-linux-v${{ steps.versioning.outputs.v_name }}.tar.gz + release_out/gothwad-browser-windows-${{ steps.versioning.outputs.v_name }}.zip + release_out/gothwad-browser-macos-${{ steps.versioning.outputs.v_name }}.zip From 34adb895f1b1f0a6130d732eef6c1df135cd6af4 Mon Sep 17 00:00:00 2001 From: Gothwad Tech Date: Mon, 23 Nov 2026 08:47:55 +0000 Subject: [PATCH 2/3] docs: professional documentation set + workflows adapted to the new layout - docs/: README index, ARCHITECTURE, BUILD, RELEASING, BRANDING, CODE_STYLE, TESTING, ROADMAP, TROUBLESHOOTING, FAQ - root: README rewrite, CHANGELOG, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT - quality.yml: inline rules gate (scripts/ removed), :app unit tests, assembleDebug - build_apk.yml / release.yml: dropped app/common tasks, desktop packaging steps and the stale debug keystore step; release asset list trimmed - app/build.gradle.kts: versionCode/versionName read -P properties from CI --- .github/workflows/build_apk.yml | 46 ----------------- .github/workflows/quality.yml | 53 +++++++++++++------- .github/workflows/release.yml | 50 ------------------- CHANGELOG.md | 41 +++++++++++++++ CODE_OF_CONDUCT.md | 42 ++++++++++++++++ CONTRIBUTING.md | 56 +++++++++++++++++++++ README.md | 82 ++++++++++++++++++++++++++++++ SECURITY.md | 42 ++++++++++++++++ app/build.gradle.kts | 5 +- docs/ARCHITECTURE.md | 88 +++++++++++++++++++++++++++++++++ docs/BRANDING.md | 57 +++++++++++++++++++++ docs/BUILD.md | 72 +++++++++++++++++++++++++++ docs/CODE_STYLE.md | 51 +++++++++++++++++++ docs/FAQ.md | 51 +++++++++++++++++++ docs/README.md | 37 ++++++++++++++ docs/RELEASING.md | 63 +++++++++++++++++++++++ docs/ROADMAP.md | 38 ++++++++++++++ docs/TESTING.md | 62 +++++++++++++++++++++++ docs/TROUBLESHOOTING.md | 54 ++++++++++++++++++++ 19 files changed, 875 insertions(+), 115 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 SECURITY.md create mode 100644 docs/ARCHITECTURE.md create mode 100644 docs/BRANDING.md create mode 100644 docs/BUILD.md create mode 100644 docs/CODE_STYLE.md create mode 100644 docs/FAQ.md create mode 100644 docs/README.md create mode 100644 docs/RELEASING.md create mode 100644 docs/ROADMAP.md create mode 100644 docs/TESTING.md create mode 100644 docs/TROUBLESHOOTING.md diff --git a/.github/workflows/build_apk.yml b/.github/workflows/build_apk.yml index 99d3fb53..94ebdda5 100644 --- a/.github/workflows/build_apk.yml +++ b/.github/workflows/build_apk.yml @@ -59,19 +59,6 @@ jobs: echo "v_code=$V_CODE" >> $GITHUB_OUTPUT echo "v_name=$V_NAME" >> $GITHUB_OUTPUT - - name: Ensure Debug Keystore Exists - run: | - if [ -f "debug.keystore.base64" ]; then - echo "Restoring debug.keystore from debug.keystore.base64..." - base64 -d debug.keystore.base64 > debug.keystore - elif [ ! -f "debug.keystore" ]; then - echo "Generating fallback debug.keystore..." - keytool -genkey -v -keystore debug.keystore \ - -storepass android -keypass android \ - -keyalg RSA -keysize 2048 -validity 10000 \ - -dname "CN=Android Debug,O=Android,C=US" \ - -alias androiddebugkey - fi - name: Build Release APK, Debug APK and AAB Bundle with Gradle run: | @@ -175,41 +162,8 @@ jobs: rm -f "$KS_PATH" echo "Keystore securely cleaned up." - - name: Build Linux Packages (.deb & .tar.gz) - run: | - chmod +x packaging/linux/build-linux-packages.sh - RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" - if [ ! -f "$RELEASE_APK" ]; then - RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" - fi - ./packaging/linux/build-linux-packages.sh \ - "$RELEASE_APK" \ - "${{ steps.versioning.outputs.v_name }}" \ - "output_release" - - name: Build Windows Package (.zip) - run: | - chmod +x packaging/windows/build-windows-package.sh - RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" - if [ ! -f "$RELEASE_APK" ]; then - RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" - fi - ./packaging/windows/build-windows-package.sh \ - "$RELEASE_APK" \ - "${{ steps.versioning.outputs.v_name }}" \ - "output_release" - - name: Build macOS Package (.app in .zip) - run: | - chmod +x packaging/macos/build-macos-package.sh - RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" - if [ ! -f "$RELEASE_APK" ]; then - RELEASE_APK="output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" - fi - ./packaging/macos/build-macos-package.sh \ - "$RELEASE_APK" \ - "${{ steps.versioning.outputs.v_name }}" \ - "output_release" - name: Upload Signed Release APK, Debug APK, AAB, Linux, Windows & macOS Packages uses: actions/upload-artifact@v4 diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index afe7f8d3..0e513b80 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -27,7 +27,24 @@ jobs: # No JDK, no SDK: this is the feedback loop that should answer in seconds. - name: Run quality gate - run: bash scripts/quality-gate.sh + run: | + set -e + fail=0 + echo "Package must be com.bansify.browser everywhere." + if grep -rn "com\.example" app/src app/build.gradle.kts 2>/dev/null; then + echo "::error::Found com.example in the tree" + fail=1 + fi + grep -q 'namespace = "com.bansify.browser"' app/build.gradle.kts \ + || { echo "::error::namespace must be com.bansify.browser"; fail=1; } + grep -q 'applicationId = "com.bansify.browser"' app/build.gradle.kts \ + || { echo "::error::applicationId must be com.bansify.browser"; fail=1; } + for f in gradlew app/build.gradle.kts settings.gradle.kts \ + app/src/main/AndroidManifest.xml app/src/main/res/values/strings.xml; do + [ -f "$f" ] || { echo "::error::missing required file $f"; fail=1; } + done + echo "Quality gate finished with status $fail" + exit $fail test: name: Unit tests @@ -53,13 +70,19 @@ jobs: - name: Unit tests (app + common) run: | set -o pipefail - ./gradlew :app:common:testDebugUnitTest testDebugUnitTest --no-daemon --continue --stacktrace 2>&1 | tee gradle.log + ./gradlew :app:testDebugUnitTest --no-daemon --continue --stacktrace 2>&1 | tee gradle.log # The raw log lives behind an endpoint a sandboxed runner often cannot reach, and a red X # with no message teaches nobody anything: put the useful lines in the job summary. - name: Publish the failure in the job summary if: failure() - run: bash scripts/ci-summarize-gradle.sh + run: | + { + echo "### Gradle failure (last 80 lines)" + echo '```' + tail -n 80 gradle.log 2>/dev/null || echo "no gradle.log" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" build: name: Compile (debug) + Android lint @@ -82,26 +105,22 @@ jobs: with: cache-read-only: ${{ github.ref != 'refs/heads/main' }} - # debug builds are wired to debug.keystore in app/build.gradle.kts; generate the standard - # debug key when the repo copy is absent, same as build_apk.yml does. - - name: Ensure debug keystore exists - run: | - if [ ! -f debug.keystore ]; then - keytool -genkey -v -keystore debug.keystore \ - -storepass android -keypass android \ - -keyalg RSA -keysize 2048 -validity 10000 \ - -dname "CN=Android Debug,O=Android,C=US" \ - -alias androiddebugkey - fi - + # Debug builds use the default ~/.android/debug.keystore that AGP creates on first use, + # so no keystore step is needed here. - name: Compile debug run: | set -o pipefail - ./gradlew :app:compileDebugKotlin :app:common:compileDebugKotlin --no-daemon --continue --stacktrace 2>&1 | tee gradle.log + ./gradlew :app:assembleDebug --no-daemon --continue --stacktrace 2>&1 | tee gradle.log - name: Publish the failure in the job summary if: failure() - run: bash scripts/ci-summarize-gradle.sh + run: | + { + echo "### Gradle failure (last 80 lines)" + echo '```' + tail -n 80 gradle.log 2>/dev/null || echo "no gradle.log" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" - name: Android lint continue-on-error: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b116f1ea..6ffa6444 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,19 +61,6 @@ jobs: echo "v_code=$V_CODE" >> $GITHUB_OUTPUT echo "v_name=$V_NAME" >> $GITHUB_OUTPUT - - name: Ensure Debug Keystore Exists - run: | - if [ -f "debug.keystore.base64" ]; then - echo "Restoring debug.keystore from debug.keystore.base64..." - base64 -d debug.keystore.base64 > debug.keystore - elif [ ! -f "debug.keystore" ]; then - echo "Generating fallback debug.keystore..." - keytool -genkey -v -keystore debug.keystore \ - -storepass android -keypass android \ - -keyalg RSA -keysize 2048 -validity 10000 \ - -dname "CN=Android Debug,O=Android,C=US" \ - -alias androiddebugkey - fi - name: Build Release APK, Debug APK and AAB run: | @@ -158,41 +145,8 @@ jobs: rm -f "$KS_PATH" echo "Keystore securely cleaned up." - - name: Build Linux Packages (.deb & .tar.gz) - run: | - chmod +x packaging/linux/build-linux-packages.sh - RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" - if [ ! -f "$RELEASE_APK" ]; then - RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" - fi - ./packaging/linux/build-linux-packages.sh \ - "$RELEASE_APK" \ - "${{ steps.versioning.outputs.v_name }}" \ - "release_out" - - name: Build Windows Package (.zip) - run: | - chmod +x packaging/windows/build-windows-package.sh - RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" - if [ ! -f "$RELEASE_APK" ]; then - RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" - fi - ./packaging/windows/build-windows-package.sh \ - "$RELEASE_APK" \ - "${{ steps.versioning.outputs.v_name }}" \ - "release_out" - - name: Build macOS Package (.app in .zip) - run: | - chmod +x packaging/macos/build-macos-package.sh - RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk" - if [ ! -f "$RELEASE_APK" ]; then - RELEASE_APK="release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk" - fi - ./packaging/macos/build-macos-package.sh \ - "$RELEASE_APK" \ - "${{ steps.versioning.outputs.v_name }}" \ - "release_out" - name: Create GitHub Release uses: softprops/action-gh-release@v2 @@ -208,7 +162,3 @@ jobs: release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab - release_out/gothwad-browser_${{ steps.versioning.outputs.v_name }}_all.deb - release_out/gothwad-browser-linux-v${{ steps.versioning.outputs.v_name }}.tar.gz - release_out/gothwad-browser-windows-${{ steps.versioning.outputs.v_name }}.zip - release_out/gothwad-browser-macos-${{ steps.versioning.outputs.v_name }}.zip diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..666c516d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,41 @@ +# Changelog + +All notable changes to this project are recorded here. The format follows +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses +[Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added +- `docs/` with architecture, build, releasing, branding, style, testing, roadmap, + troubleshooting and FAQ pages. +- `CONTRIBUTING.md`, `SECURITY.md`, `CODE_OF_CONDUCT.md` and this changelog. + +### Changed +- `.github/workflows/quality.yml`, `build_apk.yml` and `release.yml` adapted to the + single-module layout: `app/common` tasks removed, the missing `scripts/` steps replaced + with inline equivalents, desktop packaging steps dropped. +- `versionCode`/`versionName` now read `-PversionCode`/`-PversionName` from CI, with local + fallbacks of `1` and `1.0`. + +## [1.0.0] — 2026-11-23 + +First build of the rewritten app. + +### Added +- New Compose browser: Chrome-style toolbar and omnibox, tab switcher, new tab page, + reading mode, overflow menu, Material 3 Expressive components. +- Bookmarks, history, downloads, shortcuts and saved tabs in Room. +- Settings surface for search, appearance, privacy, content, downloads and language. +- Bansify account screen with sync preferences (local state only). +- Chrome-style launcher icon: white mark on the brand blue `#0494F4`, every density plus + adaptive and monochrome layers. + +### Changed +- Package and namespace are `com.bansify.browser`. +- The previous TV-Bro-derived multi-module code base was replaced with this single-module + project. + +### Removed +- `app/common` module, `buildSrc` convention plugin, `packaging/` desktop scripts and the + `scripts/` CI helpers that belonged to the old layout. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..ce3db519 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,42 @@ +# Code of conduct + +## Our commitment + +We want this project to be a place where anyone can contribute without being harassed, +insulted or dismissed — regardless of age, body size, disability, ethnicity, gender identity +or expression, level of experience, nationality, personal appearance, race, religion or +sexual identity and orientation. + +## Expected behaviour + +- Be direct about code and kind about people. Review the change, not the author. +- Assume good faith, ask before assuming, and accept that you may be wrong. +- Keep discussion in English and on topic. +- Respect that maintainers decide scope; a rejected proposal is not a personal attack. +- Give credit for work you build on. + +## Unacceptable behaviour + +- Harassment, threats, insults, slurs or sexualised comments or imagery. +- Publishing someone's private information without permission. +- Sustained disruption of discussions, issues or reviews. +- Dismissing a report of a problem with "just don't use it". + +## Scope + +This applies in issues, pull requests, commit messages, code review and any space where +someone is representing the project. + +## Reporting + +Report a problem privately to `gothwadtech@gmail.com`. Include what happened, where and +who was involved. Maintainers will review it and respond as quickly as they can, and will +keep the reporter's identity confidential. + +Consequences escalate with severity: a private warning, a temporary ban from the +repository, or a permanent ban. Maintainers may remove comments, commits or contributions +that break these rules. + +## Attribution + +Adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..98230a06 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,56 @@ +# Contributing + +## Before you start + +- Read [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) so a change lands in the right layer. +- Build once locally: `./gradlew :app:assembleDebug` (see [docs/BUILD.md](docs/BUILD.md)). +- For anything larger than a bug fix, open an issue first and describe the change. + +## Ground rules + +1. **Do not edit `.github/workflows/**`.** Workflow files are maintainer-owned. If a change + needs one, open an issue with the exact diff you want. +2. **English only** — code, comments, UI strings, docs and commit messages. +3. **No secrets in the repository** — no keystores, passwords, API keys or tokens. Refer to + a secret by name. +4. **Keep the package id** `com.bansify.browser` and the `namespace` in step with it. +5. **One concern per pull request.** A refactor and a feature in one PR cannot be reviewed. + +## Branches and commits + +```text +main always buildable +feat/ new behaviour +fix/ bug fix +docs/ documentation only +``` + +Commit messages use the imperative mood and a scope where it helps: + +```text +feat(tabs): keep the active tab after closing the last incognito tab +fix(downloads): resume the queue after a network drop +docs: add the releasing checklist +``` + +## Pull request checklist + +- [ ] `./gradlew :app:assembleDebug` succeeds +- [ ] `./gradlew :app:testDebugUnitTest` passes +- [ ] new behaviour has a test, or the PR says why it cannot be tested +- [ ] user-visible strings are in `strings.xml` +- [ ] docs updated in the same PR (`docs/`, `CHANGELOG.md`) +- [ ] screenshots or a screen recording for any UI change +- [ ] no workflow, keystore or secret changes + +## Code review + +Reviewers look for: correct layer (UI vs ViewModel vs data), lifecycle-safe state, no +`!!`, no swallowed exceptions, string resources, and a test that would fail if the bug came +back. Style details are in [docs/CODE_STYLE.md](docs/CODE_STYLE.md). + +## Reporting bugs + +Include: app version (`Settings → About` or the APK name), Android version and device, +steps to reproduce, expected vs actual, and logcat lines around the failure. A screenshot of +a broken page is worth more than a paragraph. diff --git a/README.md b/README.md new file mode 100644 index 00000000..7db265e4 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +# Bansify Browser + +A fast, privacy-respecting web browser for Android phones, tablets and TVs, built with +Kotlin and Jetpack Compose. Chrome-style toolbar and omnibox, tab switcher, reading mode, +bookmarks, history, downloads and a local settings surface — with no account required to +browse. + +

+ Platform + Kotlin + Compose + Package +

+ +## Features + +- **Chrome-style UI** — toolbar with omnibox, page actions and overflow menu; the address + bar can sit at the top or the bottom. +- **Tabs** — tab switcher with tab groups of one, incognito tabs, recent tabs, saved tabs. +- **New tab page** — shortcuts, most-visited tiles and a search box. +- **Reading mode** — strips a page down to readable text. +- **Bookmarks, history, downloads** — stored locally in Room, searchable and deletable. +- **Privacy controls** — incognito, safe browsing level, HTTPS-first, Do Not Track, + third-party cookie policy, JavaScript and pop-up switches, "delete browsing data". +- **Bansify account** — sign-in surface and sync preferences (local placeholder today, see + [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#accounts)). +- **Material 3 Expressive** components with a Chrome-like colour system. + +## Quick start + +```bash +git clone https://github.com/Bansify/browser.git +cd browser +./gradlew :app:assembleDebug # debug APK in app/build/outputs/apk/debug/ +./gradlew :app:installDebug # install on a connected device/emulator +``` + +Requirements: JDK 17+ (CI uses 21), Android SDK with platform 36, and the committed Gradle +wrapper (9.3.1). No keystore is needed for debug builds. + +Full instructions: [docs/BUILD.md](docs/BUILD.md). + +## Project structure + +```text +app/src/main/java/com/bansify/browser/ +├── MainActivity.kt # single activity, edge-to-edge, handles VIEW intents +├── browser/ # WebViewPool (tabs), UrlUtils +├── data/ # Room (bookmarks/history/downloads/shortcuts/saved tabs), +│ # DataStore settings, repository, account state +├── ui/ # BrowserApp, components (toolbar, omnibox, menus), +│ # screens (new tab, history, bookmarks, settings, …), theme +└── viewmodel/ # BrowserViewModel: tabs, navigation, settings, history +``` + +## Documentation + +| Document | What is inside | +|---|---| +| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Layers, data flow, Room schema, tab/WebView model | +| [docs/BUILD.md](docs/BUILD.md) | Prerequisites, build commands, variants, troubleshooting | +| [docs/RELEASING.md](docs/RELEASING.md) | Versioning, signing secrets, store checklist | +| [docs/BRANDING.md](docs/BRANDING.md) | Colour tokens, launcher icon, typography | +| [docs/CODE_STYLE.md](docs/CODE_STYLE.md) | Kotlin/Compose conventions for this repo | +| [docs/TESTING.md](docs/TESTING.md) | Test layers and the manual QA checklist | +| [docs/ROADMAP.md](docs/ROADMAP.md) | What is done, next and later | +| [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) | Common build and runtime problems | +| [docs/FAQ.md](docs/FAQ.md) | Product and contributor questions | +| [CHANGELOG.md](CHANGELOG.md) | Release history | +| [CONTRIBUTING.md](CONTRIBUTING.md) | How to propose and land a change | +| [SECURITY.md](SECURITY.md) | How to report a vulnerability | + +## Status + +The app compiles and produces a debug APK on every pull request. The signed release +pipeline and the store listing are not wired yet — see [docs/RELEASING.md](docs/RELEASING.md). + +## License + +No license file is present in this repository yet. Until the owner adds one, the code is +all rights reserved: do not redistribute or reuse it. See +[docs/FAQ.md](docs/FAQ.md#can-i-reuse-this-code). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..86c52209 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,42 @@ +# Security policy + +## Supported versions + +Only the latest build on `main` is supported. Older builds are not patched. + +## Reporting a vulnerability + +**Do not open a public issue.** Report privately to the maintainer +(`gothwadtech@gmail.com`) with: + +- what the issue is and which component (UI, WebView plumbing, storage, account) +- steps to reproduce, or a proof of concept +- the app version, Android version and device +- the impact you believe it has + +You can expect an acknowledgement within a few days. Please give time for a fix before any +public disclosure. + +## Scope + +In scope: + +- the app's own code (Kotlin, manifest, exported components, intents) +- storage of browsing data, bookmarks, history and downloads +- the account surface and any tokens it handles +- unsafe handling of web content (file access, intent URLs, downloads) + +Out of scope: + +- vulnerabilities in Chromium/WebView itself — report those to Google +- sites the user visits +- a rooted or otherwise compromised device +- missing hardening that requires an unlocked bootloader to matter + +## Handling secrets + +- No keystore, password, API key or token is ever committed. Signing material lives in + GitHub Actions secrets (`RELEASE_KEYSTORE_BASE64`, `KEYSTORE_PASSWORD`, `KEY_ALIAS`, + `KEY_PASSWORD`). +- `.env` is git-ignored; only `.env.example` is tracked, and it contains placeholders. +- If a secret leaks, rotate it first and treat any artifact signed with it as untrusted. diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f4b41316..1d8bdcec 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,8 +16,9 @@ android { applicationId = "com.bansify.browser" minSdk = 24 targetSdk = 36 - versionCode = 1 - versionName = "1.0" + // CI passes -PversionCode / -PversionName; local builds keep the defaults. + versionCode = (project.findProperty("versionCode") as? String)?.toIntOrNull() ?: 1 + versionName = (project.findProperty("versionName") as? String)?.takeIf { it.isNotBlank() } ?: "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 00000000..9e2a4bab --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,88 @@ +# Architecture + +Single-module Android app. One activity hosts all Compose UI; a single `BrowserViewModel` +owns browser state; Room and DataStore hold everything that survives a restart. + +## Layers + +```text +┌─────────────────────────────────────────────────────────────┐ +│ ui/ Compose screens and components (stateless) │ +│ BrowserApp → Toolbar, Omnibox, Screens │ +├─────────────────────────────────────────────────────────────┤ +│ viewmodel/ BrowserViewModel — tabs, navigation, settings │ +│ exposes StateFlow, performs no I/O on the UI │ +├─────────────────────────────────────────────────────────────┤ +│ data/ BrowserRepository (Room + DataStore), │ +│ BrowserPreferences, BansifyAccountStore │ +├─────────────────────────────────────────────────────────────┤ +│ browser/ WebViewPool — one WebView per tab, chrome │ +│ client, download and permission plumbing │ +└─────────────────────────────────────────────────────────────┘ +``` + +## Entry point + +`MainActivity` is the only activity. It calls `enableEdgeToEdge()`, forwards `ACTION_VIEW` +intents to the ViewModel (`openUrlInActiveTab` or `createNewTab`, depending on the +"open external links in new tab" setting) and renders `BrowserApp`. `onNewIntent` handles +links that arrive while the app is already running; `launchMode` is `singleTask`. + +## Tabs and WebViews + +`browser/WebViewPool.kt` keeps the live `WebView` instances: + +- one `WebView` per tab, created lazily and cached by tab id; +- a `WebChromeClient` for progress, title, favicons, JS dialogs, file chooser and + `target=_blank` pop-ups; +- a `WebViewClient` that maps URL loading, SSL errors, safe-browsing hits and download + requests into the ViewModel; +- downloads go through Android's `DownloadManager`, so they survive the app being closed. + +Incognito tabs are separate `WebView` instances with their own (cleared) data directory +behaviour and are dropped when the last incognito tab closes. + +## State + +`BrowserViewModel` exposes `StateFlow`s, so the UI recomposes without holding business +logic: + +| Flow | Meaning | +|---|---| +| `tabs` | open tabs with title, url, favicon, incognito flag, active tab id | +| `settings` | every user preference (see `BrowserPreferences`) | +| `account` | Bansify account state and sync toggles | +| `addressBar` | omnibox text, focus, editing state | +| `pageState` | loading progress, title, url, canGoBack/canGoForward | + +## Persistence + +**Room** (`BrowserDatabase`, version 1) — five tables, all with a DAO in `BrowserDao`: + +| Table | Holds | +|---|---| +| `bookmarks` | title, url, created timestamp | +| `history` | title, url, visited timestamp | +| `downloads` | file name, url, path, status, size, timestamp | +| `shortcuts` | new-tab page tiles | +| `saved_tabs` | tabs the user parked for later | + +**DataStore** (`BrowserPreferences`) — search engine, address-bar position, theme mode, +homepage, safe-browsing level, HTTPS-first, Do Not Track, third-party cookie policy, +JavaScript/cookies/pop-ups/images switches, desktop-site default, media autoplay, text zoom, +force-enable zoom, download notifications, preferred language, offer-to-translate and the +incognito-on-leave lock. Every key is a typed `Preferences.Key`. + +## Accounts + +`data/BansifyAccount.kt` stores a **local** account state (display name, email, avatar +colour, sync toggles) in its own DataStore. It is a UI placeholder: it does not talk to the +Gothwad Accounts service and it does not sync anything yet. Real SSO is tracked in +[ROADMAP.md](ROADMAP.md). + +## Conventions that keep the architecture honest + +- Screens take state and callbacks; they never construct a repository or a `WebView`. +- The ViewModel never touches `Context` beyond what it is given at construction. +- Anything that must survive process death goes to Room or DataStore, never to a field. +- No network client of its own: pages are rendered by the platform `WebView`. diff --git a/docs/BRANDING.md b/docs/BRANDING.md new file mode 100644 index 00000000..cde4ff3d --- /dev/null +++ b/docs/BRANDING.md @@ -0,0 +1,57 @@ +# Branding + +## Name + +- Product: **Bansify Browser** +- Package / namespace: `com.bansify.browser` +- Short form in UI: "Browser" only where space is tight (tab strip, notifications) + +## Colour + +| Token | Value | Use | +|---|---|---| +| Brand blue | `#0494F4` | launcher icon background, primary accents, links | +| Chrome blue (current theme primary) | `#0B57D0` | `ChromeBluePrimary` in `ui/theme/Color.kt` | +| Surface / background | `#FFFFFF` light, dark palette in `Theme.kt` | page chrome | + +Changing the accent to the brand blue means editing `ChromeBluePrimary` and its +`onPrimary`/`primaryContainer` siblings in `ui/theme/Color.kt` — the rest of the theme reads +those tokens. + +## Launcher icon + +The mark is the Chrome-style three-blade pinwheel, drawn in **solid white on `#0494F4`**. + +Files (all generated from one master, never hand-edited): + +```text +app/src/main/res/mipmap-{mdpi,hdpi,xhdpi,xxhdpi,xxxhdpi}/ +├── ic_launcher.png # legacy square +├── ic_launcher_round.png # legacy round +├── ic_launcher_background.png # adaptive background: solid #0494F4 +├── ic_launcher_foreground.png # adaptive foreground: white mark, inside the safe zone +└── ic_launcher_monochrome.png # themed icons +app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +``` + +Rules that keep the icon correct on every launcher: + +- The foreground mark stays inside the inner 66% of the canvas; anything outside is cropped + by the launcher mask. +- The background layer is a flat colour, so no scaling artefacts appear. +- Density sizes: legacy 48/72/96/144/192 px, adaptive layers 108/162/216/324/432 px. + +A 512×512 store icon uses the same plate without the adaptive padding. + +## Typography + +`ui/theme/Type.kt` defines the type scale; the bundled fonts are `inter.ttf` and +`plus_jakarta_sans.ttf` in `res/font/`. Use the Compose `MaterialTheme.typography` roles +rather than hard-coded sizes. + +## Writing style + +- Sentence case for labels and buttons ("New tab", not "New Tab"). +- No exclamation marks, no marketing superlatives inside the app. +- UI strings live in `res/values/strings.xml`; never inline a user-visible literal in Kotlin. diff --git a/docs/BUILD.md b/docs/BUILD.md new file mode 100644 index 00000000..0209bcd3 --- /dev/null +++ b/docs/BUILD.md @@ -0,0 +1,72 @@ +# Build + +## Prerequisites + +| Tool | Version | Notes | +|---|---|---| +| JDK | 17 or newer | CI uses Temurin 21 | +| Android SDK | platform 36, build-tools latest | `compileSdk`/`targetSdk` 36, `minSdk` 24 | +| Gradle | via the committed wrapper (9.3.1) | never install Gradle globally | +| Kotlin | 2.4.21 | supplied by the build | + +Set `ANDROID_HOME` (or `sdk.dir` in `local.properties`) before the first build. + +## Commands + +```bash +./gradlew :app:assembleDebug # debug APK → app/build/outputs/apk/debug/ +./gradlew :app:installDebug # install on the connected device +./gradlew :app:testDebugUnitTest # JVM unit tests +./gradlew :app:lintDebug # Android lint +./gradlew :app:assembleRelease # release APK (signed only if KEYSTORE_PATH is set) +./gradlew :app:bundleRelease # Play Store AAB +``` + +Clean build when the Gradle cache misbehaves: + +```bash +./gradlew clean --no-daemon +rm -rf .gradle app/build build +``` + +## Variants and signing + +- **debug** — signed with the standard `~/.android/debug.keystore` that AGP creates on first + use. Nothing to configure; no keystore is committed. +- **release** — signed only when the environment provides a keystore: + + ```bash + export KEYSTORE_PATH=/absolute/path/to/release.jks + export KEYSTORE_PASSWORD=… # STORE_PASSWORD also accepted + export KEY_ALIAS=… # defaults to "upload" + export KEY_PASSWORD=… + ./gradlew :app:assembleRelease + ``` + + Without those variables the release APK is produced **unsigned**, which is what the + release workflow expects: it signs the artifact itself with `apksigner`. + +CI passes `-PversionCode` and `-PversionName`; local builds fall back to `1` and `1.0`. + +## Build configuration in one place + +| Setting | Where | +|---|---| +| applicationId / namespace | `app/build.gradle.kts` → both `com.bansify.browser` | +| SDK levels, version code/name | `app/build.gradle.kts` | +| Dependency versions | `gradle/libs.versions.toml` | +| Optional secrets (`.env`) | `app/build.gradle.kts` → `secrets { }`, template in `.env.example` | + +## What the build does not need + +- No `google-services.json` — the Firebase plugin is configured with + `MissingGoogleServicesStrategy.WARN`, so a missing file is a warning, not a failure. +- No `.env` file — the Secrets plugin falls back to `.env.example`. +- No network access beyond Maven repositories. + +## Continuous integration + +`.github/workflows/quality.yml` runs on every pull request and on `main`: a fast rules gate, +JVM unit tests, a debug assemble and Android lint. `build_apk.yml` (push to `main`) and +`release.yml` (tags `v*`) build and sign the release artifacts. Workflow files are owned by +the maintainer — see [../CONTRIBUTING.md](../CONTRIBUTING.md). diff --git a/docs/CODE_STYLE.md b/docs/CODE_STYLE.md new file mode 100644 index 00000000..6d950b28 --- /dev/null +++ b/docs/CODE_STYLE.md @@ -0,0 +1,51 @@ +# Code style + +Kotlin + Jetpack Compose, Material 3. Follow the existing files rather than introducing a +second way of doing the same thing. + +## Naming + +| Kind | Convention | Example | +|---|---|---| +| Class / composable | PascalCase | `ChromeToolbar`, `BrowserViewModel` | +| Function / property | camelCase | `openUrlInActiveTab` | +| Composable that emits UI | PascalCase noun | `TabSwitcherScreen` | +| Constant | UPPER_SNAKE_CASE | `MAX_TAB_COUNT` | +| Room entity | `Entity` | `BookmarkEntity` | +| Screen file | `Screen.kt` | `HistoryScreen.kt` | + +## Compose + +- Screens are **stateless**: they receive state and lambdas, they do not reach for a + repository, `Context` or `WebView`. +- Collect state with `collectAsStateWithLifecycle()`, never `collectAsState()` in a screen. +- Hoist state to the ViewModel; `remember` is only for pure UI state (menu open, scroll). +- Every interactive element gets a `contentDescription` or a visible label; icons without + text need one. +- Prefer `MaterialTheme.colorScheme` / `MaterialTheme.typography` over literal values. +- Keep one screen per file. If a file passes ~500 lines, split the pieces out. + +## Kotlin + +- No `!!`. Use `?.let`, early returns or `requireNotNull` with a message. +- Prefer immutable `data class` state and `StateFlow` over mutable fields. +- Coroutines: `viewModelScope` in the ViewModel, `Dispatchers.IO` for disk work, no + blocking calls on the main thread. +- Catch only what you can handle; never swallow an exception with an empty `catch`. +- Public functions get a KDoc line only when the name does not already say it. + +## Resources + +- All user-visible strings in `res/values/strings.xml`. +- Colours in `ui/theme/Color.kt` (Compose) or `res/values/colors.xml` (XML themes), not + inline hex in composables. +- No hard-coded dimensions for anything that must adapt to font scale; use `sp`/`dp` tokens. + +## Comments + +Explain **why**, not what. A comment that repeats the code is noise; a comment that records a +platform quirk (WebView, downloads, permission handling) saves the next person an afternoon. + +## Commits and branches + +See [../CONTRIBUTING.md](../CONTRIBUTING.md). diff --git a/docs/FAQ.md b/docs/FAQ.md new file mode 100644 index 00000000..a647ed6e --- /dev/null +++ b/docs/FAQ.md @@ -0,0 +1,51 @@ +# FAQ + +## Product + +**Does it need an account?** +No. Browsing, tabs, bookmarks, history, downloads and every setting work without signing in. +The account screen exists so bookmarks and history can sync later — today it stores state on +the device only. + +**Does it block ads?** +Not yet. Safe browsing, HTTPS-first, Do Not Track and third-party cookie controls are in. +Filter-list based blocking is on the roadmap, not in the build. + +**Where is my history stored?** +In a local Room database inside the app's private storage. Nothing is uploaded. Incognito +tabs never write history. + +**Can I set it as the default browser?** +Yes on Android 7+ once the app declares the HTTP/HTTPS intent filters for its build. If the +system picker does not offer it, the build is missing those filters — check +`AndroidManifest.xml` before filing a bug. + +**Does it work on a TV?** +The UI is built for touch and D-pad; a remote can drive the toolbar and page focus. TV polish +is on the roadmap. + +## Development + +**Which Gradle/JDK do I need?** +Use the committed wrapper (9.3.1) and JDK 17–21. See [BUILD.md](BUILD.md). + +**Why is `namespace` the same as `applicationId`?** +Both are `com.bansify.browser`; the sources live in `com/bansify/browser/**`, so the +generated `R` class matches the package. + +**Why do debug builds not need a keystore?** +Debug builds are signed with the standard `~/.android/debug.keystore` that AGP creates on +first use. Release builds take the keystore from `KEYSTORE_PATH` (see [RELEASING.md](RELEASING.md)). + +**Can I change a workflow file?** +No. `.github/workflows/**` is maintainer-owned; open an issue with the change you need. See +[../CONTRIBUTING.md](../CONTRIBUTING.md). + +**Where do new strings go?** +`app/src/main/res/values/strings.xml`. English only, sentence case. + +## Can I reuse this code? + +There is no `LICENSE` file in this repository yet, so no licence is granted: the code is all +rights reserved and must not be copied, redistributed or reused until the owner adds one. If +you are the owner, adding a `LICENSE` file is the one step that makes reuse explicit. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..d875647b --- /dev/null +++ b/docs/README.md @@ -0,0 +1,37 @@ +# Documentation + +One place per topic. If a document grows past a single responsibility, split it and add a +row here. + +## Start here + +| Document | Purpose | +|---|---| +| [../README.md](../README.md) | What the app is, features, quick start | +| [ARCHITECTURE.md](ARCHITECTURE.md) | How the code is organised and how data flows | +| [BUILD.md](BUILD.md) | Prerequisites, commands, variants, signing | +| [RELEASING.md](RELEASING.md) | Versioning, secrets, store checklist | +| [BRANDING.md](BRANDING.md) | Colours, icon, typography, naming | +| [CODE_STYLE.md](CODE_STYLE.md) | Kotlin and Compose conventions | +| [TESTING.md](TESTING.md) | Test layers and the manual QA checklist | +| [ROADMAP.md](ROADMAP.md) | Done, next, later | +| [TROUBLESHOOTING.md](TROUBLESHOOTING.md) | Build and runtime problems | +| [FAQ.md](FAQ.md) | Product and contributor questions | + +## Repository-level documents + +| Document | Purpose | +|---|---| +| [../CHANGELOG.md](../CHANGELOG.md) | Release history, newest first | +| [../CONTRIBUTING.md](../CONTRIBUTING.md) | Branch, commit and review rules | +| [../SECURITY.md](../SECURITY.md) | Reporting a vulnerability | +| [../CODE_OF_CONDUCT.md](../CODE_OF_CONDUCT.md) | Community expectations | + +## Rules for these documents + +1. **Keep them true.** A document that describes an old layout is worse than no document. + When a change alters behaviour, update the matching file in the same pull request. +2. **One responsibility per file.** Build steps do not belong in the architecture page. +3. **No secrets.** Never paste a keystore, password, API key or token. Refer to the secret + name instead, for example `KEYSTORE_PASSWORD`. +4. **English only**, same as the code and the UI. diff --git a/docs/RELEASING.md b/docs/RELEASING.md new file mode 100644 index 00000000..960b162e --- /dev/null +++ b/docs/RELEASING.md @@ -0,0 +1,63 @@ +# Releasing + +## Versioning + +`versionCode` and `versionName` come from `-PversionCode` / `-PversionName`, which the +workflows fill in automatically: + +- `build_apk.yml` — `versionCode = github.run_number`, `versionName = 1.0.` + unless you pass the manual inputs. +- `release.yml` — same, except a `v*` tag supplies the name (`v1.2.0` → `1.2.0`). + +Local builds fall back to `1` / `1.0`. + +## Signing + +The release keystore is **never** committed. The workflows read four repository secrets: + +| Secret | Meaning | +|---|---| +| `RELEASE_KEYSTORE_BASE64` | `base64 -w0 release.jks` | +| `KEYSTORE_PASSWORD` | keystore password | +| `KEY_ALIAS` | key alias inside the keystore | +| `KEY_PASSWORD` | key password | + +If `RELEASE_KEYSTORE_BASE64` is missing the workflow generates a **temporary** keystore and +warns — useful for a smoke build, useless for the store, because every build then has a +different signing identity. Set the four secrets before shipping anything. + +The keystore for this app must stay the same for the whole life of the listing: Android only +accepts an update signed by the same key. Keep a copy outside GitHub (password manager plus +an offline backup). + +## Steps for a release + +1. Merge the change into `main` and confirm the `Quality Gate & Tests` run is green. +2. Push a tag: `git tag v1.2.0 && git push origin v1.2.0` — `release.yml` builds the APK, + the debug APK and the AAB, signs them and publishes a GitHub Release. +3. Download the `-Release.apk` from the release page and check the certificate: + + ```bash + apksigner verify --print-certs app-release.apk + ``` + + The SHA-256 must match the fingerprint kept with the keystore backup. +4. Upload the `-PlayStore.aab` to the Play Console, or side-load the APK on a device and run + the checklist in [TESTING.md](TESTING.md). +5. Update [../CHANGELOG.md](../CHANGELOG.md). + +## Current state + +`build_apk.yml` and `release.yml` have been adapted to the single-module layout (no +`app/common` module, no `packaging/` desktop scripts). They still expect the four signing +secrets above; until those exist, treat their output as a smoke build only. + +## Store checklist + +- [ ] `applicationId` unchanged (`com.bansify.browser`) +- [ ] `versionCode` strictly greater than the published build +- [ ] signed with the same key as the live listing +- [ ] target SDK meets the current Play requirement +- [ ] privacy policy URL and data-safety answers match what the app actually does +- [ ] screenshots and the 512×512 store icon (from the icon kit) updated +- [ ] release notes written in [../CHANGELOG.md](../CHANGELOG.md) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md new file mode 100644 index 00000000..90466b5a --- /dev/null +++ b/docs/ROADMAP.md @@ -0,0 +1,38 @@ +# Roadmap + +Ordered by what unblocks the most work. Nothing here is a promise of a date. + +## Done + +- Single-module Compose app with Chrome-style toolbar, omnibox, tab switcher, reading mode. +- New tab page with shortcuts, bookmarks, history, downloads, saved tabs (Room). +- Settings surface covering privacy, content, appearance and downloads. +- Bansify package id (`com.bansify.browser`) and the white-on-#0494F4 launcher icon. +- Debug builds and CI on every pull request. + +## Next + +1. **Real Gothwad Accounts sign-in** — the account screen currently stores local state only. + Wire it to `accounts.bansify.com` (native `/api/mobile/auth/*` flow) so the browser uses + the same account as Mail, Drive and Store. +2. **Sync** — bookmarks, history and open tabs against the account, opt-in per category + (the toggles already exist in the account model). +3. **Signed release pipeline** — set the four signing secrets, tag a build, publish the APK + and AAB from `release.yml`. +4. **Test coverage** — replace the template tests with real coverage for `UrlUtils`, + `BrowserViewModel` and the DAOs (see [TESTING.md](TESTING.md)). + +## Later + +- Ad and tracker blocking with a user-editable filter list. +- Reader-mode typography controls and text-to-speech. +- Tab groups and a grid/list tab switcher layout option. +- Desktop-mode per site, remembered. +- Downloads: pause/resume, share sheet integration, storage-location choice. +- TV: focus ring polish, remote shortcuts, leanback launcher entry. +- Translations (the string resources are ready for `values-`). + +## Not planned + +- Bundled ad-blocking engine that bypasses site paywalls. +- Any feature that requires collecting browsing history on a server without explicit opt-in. diff --git a/docs/TESTING.md b/docs/TESTING.md new file mode 100644 index 00000000..6d9dd58a --- /dev/null +++ b/docs/TESTING.md @@ -0,0 +1,62 @@ +# Testing + +## Layers + +| Layer | Location | Runs | +|---|---|---| +| JVM unit tests | `app/src/test/java/com/bansify/browser/` | `./gradlew :app:testDebugUnitTest` | +| Robolectric | same folder (`ExampleRobolectricTest`) | part of the unit test task | +| Instrumented | `app/src/androidTest/java/com/bansify/browser/` | `./gradlew :app:connectedDebugAndroidTest` (device needed) | +| CI | `.github/workflows/quality.yml` | rules gate, unit tests, debug assemble, lint | + +The three test classes that ship today are the template examples. Replace them with real +coverage as behaviour lands — start with `UrlUtils` (pure functions, cheapest to test) and +`BrowserViewModel` tab operations. + +## What is worth testing first + +1. `browser/UrlUtils.kt` — search-vs-URL detection, scheme handling, display URL. +2. `BrowserViewModel` — new tab / close tab / active tab switching, incognito isolation. +3. Room DAOs — bookmark and history insert, delete, ordering. +4. `BrowserPreferences` — defaults when the DataStore is empty. + +## Manual QA checklist + +Run this on a phone and, where possible, on a TV/tablet before a release. + +**Startup** +- [ ] Cold start shows the new tab page, no flicker, no crash +- [ ] Rotating the device keeps the page and the tab strip state + +**Browsing** +- [ ] Type a URL → loads; type a search term → goes to the configured search engine +- [ ] Back / forward / reload / stop behave correctly +- [ ] Long press a link → open in new tab, copy link, download +- [ ] `target=_blank` pop-up opens as a new tab, not a dead page +- [ ] File chooser (upload) opens and returns a file +- [ ] Video plays inline and in fullscreen; audio stops when the tab closes + +**Tabs** +- [ ] Open several tabs, switch, close; the correct tab stays active +- [ ] Incognito tab does not appear in history and is gone after closing all incognito tabs +- [ ] Saved tabs restore after a restart + +**Data** +- [ ] Bookmark / unbookmark from the toolbar menu +- [ ] History records visits and can be cleared +- [ ] Download completes, appears in Downloads, opens from there +- [ ] "Delete browsing data" clears what it says it clears + +**Settings** +- [ ] Address bar position switches top/bottom and survives a restart +- [ ] Theme mode (system/light/dark) applies immediately +- [ ] JavaScript, images, pop-ups and cookies switches take effect on the next load +- [ ] Text zoom and force-enable-zoom affect page rendering + +**Account surface** +- [ ] Sign-in screen opens, back works, no crash with no network + +**Platform** +- [ ] `ACTION_VIEW` from another app opens the link in this browser +- [ ] Back gesture at the start of history leaves the app instead of looping +- [ ] TV remote D-pad can move through the toolbar and page links (TV builds) diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md new file mode 100644 index 00000000..045aa0dc --- /dev/null +++ b/docs/TROUBLESHOOTING.md @@ -0,0 +1,54 @@ +# Troubleshooting + +## Build + +**`SDK location not found`** +Create `local.properties` with `sdk.dir=/path/to/Android/sdk`, or export `ANDROID_HOME`. + +**`Unsupported class file major version`** +The JDK is too new or too old for the Gradle/AGP pair. Use JDK 17–21; CI uses 21. + +**`Could not resolve …` / timeouts** +Check the network/proxy, then `./gradlew --refresh-dependencies`. Corporate proxies need +`gradle.properties` entries, not shell variables. + +**`Execution failed for task ':app:processDebugGoogleServices'`** +No `google-services.json`. The build is configured to warn instead of fail, so if it does +fail, check that `googleServices { missingGoogleServicesStrategy = … }` is still in +`app/build.gradle.kts`. + +**KSP / Room errors after a dependency bump** +`./gradlew clean` then rebuild. Room's generated code lives in `app/build/generated/ksp/`. + +## Runtime + +**Blank page or `net::ERR_…`** +Usually TLS or a blocked host. Check logcat for the `WebViewClient.onReceivedError` entry; +the app surfaces SSL and safe-browsing errors through the ViewModel. + +**Downloads do not start** +Android 10+ needs a writable location and, on some OEM builds, the storage permission for +the chosen folder. Check `DownloadManager` in logcat. + +**Incognito tab keeps state** +Closing the last incognito tab should drop its `WebView`. If it does not, note the tab id and +the `WebViewPool` cache entry in a bug report. + +**Settings do not stick** +Every preference goes through DataStore. If one resets, check that its key exists in +`BrowserPreferences.Keys` and that the flow is collected with +`collectAsStateWithLifecycle()`. + +## CI + +**`quality.yml` red on the rules gate** +The gate greps for `com.example` and requires `namespace`/`applicationId` to be +`com.bansify.browser`. Fix the source; do not relax the gate. + +**`build_apk.yml` / `release.yml` red at signing** +The four signing secrets are missing or the alias does not exist in the keystore. The +workflow prints the detected alias — compare it with `KEY_ALIAS`. + +**Workflow changes** +Workflow files are owned by the maintainer. Do not edit them in a feature pull request; open +an issue instead. From 58a141df577f4289264ad7d3070b44f2b0bbcd7a Mon Sep 17 00:00:00 2001 From: Gothwad Tech Date: Mon, 23 Nov 2026 09:14:26 +0000 Subject: [PATCH 3/3] fix(ci): release file list and artifact names - build_apk.yml no longer lists the .deb/.tar.gz/.zip files that the new layout does not build, so the release step cannot fail on a missing asset - artifacts renamed GothwadTVBrowser-* -> BansifyBrowser-* (the website matches the -Release.apk suffix, so every download link keeps working) - temp keystore defaults and the upload step name follow the Bansify brand --- .github/workflows/build_apk.yml | 34 +++++++++++++++------------------ .github/workflows/release.yml | 18 ++++++++--------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build_apk.yml b/.github/workflows/build_apk.yml index 94ebdda5..bb022247 100644 --- a/.github/workflows/build_apk.yml +++ b/.github/workflows/build_apk.yml @@ -84,12 +84,12 @@ jobs: # 0. Copy Debug APK directly (already signed with debug keystore) if [ -n "$DEBUG_APK" ]; then - cp "$DEBUG_APK" output_release/GothwadTVBrowser-v${V_NAME}-Debug.apk - echo "Successfully included Debug APK: output_release/GothwadTVBrowser-v${V_NAME}-Debug.apk" + cp "$DEBUG_APK" output_release/BansifyBrowser-v${V_NAME}-Debug.apk + echo "Successfully included Debug APK: output_release/BansifyBrowser-v${V_NAME}-Debug.apk" fi # Store keystore in secure temporary location outside release outputs - KS_PATH="/tmp/gothwad_release_key.jks" + KS_PATH="/tmp/bansify_release_key.jks" if [ -n "$KEYSTORE_BASE64" ]; then echo "Using Permanent Keystore from GitHub Secrets..." @@ -100,12 +100,12 @@ jobs: fi else echo "⚠️ No GitHub Secret found! Generating temporary keystore..." - DEFAULT_ALIAS="${KEY_ALIAS:-gothwad_tv_key}" + DEFAULT_ALIAS="${KEY_ALIAS:-bansify_key}" keytool -genkey -v \ -keystore "$KS_PATH" \ -keyalg RSA -keysize 2048 -validity 10000 \ -alias "$DEFAULT_ALIAS" \ - -dname "CN=Gothwad TV Browser, OU=AppDev, O=Gothwad, C=IN" \ + -dname "CN=Bansify Browser, O=Bansify, C=IN" \ -storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" fi @@ -117,7 +117,7 @@ jobs: elif [ -n "$DETECTED_ALIAS" ]; then ACTUAL_ALIAS="$DETECTED_ALIAS" else - ACTUAL_ALIAS="gothwad_tv_key" + ACTUAL_ALIAS="bansify_key" fi echo "Using Keystore Alias: $ACTUAL_ALIAS" @@ -140,20 +140,20 @@ jobs: --ks-key-alias "$ACTUAL_ALIAS" \ --ks-pass "pass:$KEYSTORE_PASS" \ --key-pass "pass:$KEY_PASS" \ - --out output_release/GothwadTVBrowser-v${V_NAME}-Release.apk \ + --out output_release/BansifyBrowser-v${V_NAME}-Release.apk \ "$UNALIGNED_TEMP" - $APKSIGNER verify --verbose output_release/GothwadTVBrowser-v${V_NAME}-Release.apk + $APKSIGNER verify --verbose output_release/BansifyBrowser-v${V_NAME}-Release.apk rm -f "$UNALIGNED_TEMP" fi # 2. Sign Play Store AAB Bundle using jarsigner if [ -n "$UNSIGNED_AAB" ]; then - cp "$UNSIGNED_AAB" output_release/GothwadTVBrowser-v${V_NAME}-PlayStore.aab + cp "$UNSIGNED_AAB" output_release/BansifyBrowser-v${V_NAME}-PlayStore.aab jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 \ -keystore "$KS_PATH" \ -storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" \ - output_release/GothwadTVBrowser-v${V_NAME}-PlayStore.aab \ + output_release/BansifyBrowser-v${V_NAME}-PlayStore.aab \ "$ACTUAL_ALIAS" echo "Successfully signed Play Store AAB!" fi @@ -165,10 +165,10 @@ jobs: - - name: Upload Signed Release APK, Debug APK, AAB, Linux, Windows & macOS Packages + - name: Upload signed release APK, debug APK and Play Store AAB uses: actions/upload-artifact@v4 with: - name: Gothwad-TV-Browser-v${{ steps.versioning.outputs.v_name }}-Build${{ steps.versioning.outputs.v_code }} + name: Bansify-Browser-v${{ steps.versioning.outputs.v_name }}-Build${{ steps.versioning.outputs.v_code }} path: output_release/ - name: Create Automatic GitHub Release @@ -182,10 +182,6 @@ jobs: prerelease: false generate_release_notes: true files: | - output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk - output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk - output_release/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab - output_release/gothwad-browser_${{ steps.versioning.outputs.v_name }}_all.deb - output_release/gothwad-browser-linux-v${{ steps.versioning.outputs.v_name }}.tar.gz - output_release/gothwad-browser-windows-${{ steps.versioning.outputs.v_name }}.zip - output_release/gothwad-browser-macos-${{ steps.versioning.outputs.v_name }}.zip + output_release/BansifyBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk + output_release/BansifyBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk + output_release/BansifyBrowser-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6ffa6444..ce668837 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,8 +83,8 @@ jobs: AAB=$(find app/build/outputs/bundle/release/ -name "*.aab" | head -n 1) if [ -n "$DEBUG_APK" ]; then - cp "$DEBUG_APK" release_out/GothwadTVBrowser-v${V_NAME}-Debug.apk - echo "Copied Debug APK: release_out/GothwadTVBrowser-v${V_NAME}-Debug.apk" + cp "$DEBUG_APK" release_out/BansifyBrowser-v${V_NAME}-Debug.apk + echo "Copied Debug APK: release_out/BansifyBrowser-v${V_NAME}-Debug.apk" fi # Store keystore in secure temporary location outside release outputs @@ -104,7 +104,7 @@ jobs: -keystore "$KS_PATH" \ -keyalg RSA -keysize 2048 -validity 10000 \ -alias "$DEFAULT_ALIAS" \ - -dname "CN=Gothwad TV Browser, O=Gothwad, C=IN" \ + -dname "CN=Bansify Browser, O=Bansify, C=IN" \ -storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" fi @@ -128,16 +128,16 @@ jobs: --ks-key-alias "$ACTUAL_ALIAS" \ --ks-pass "pass:$KEYSTORE_PASS" \ --key-pass "pass:$KEY_PASS" \ - --out release_out/GothwadTVBrowser-v${V_NAME}-Release.apk \ + --out release_out/BansifyBrowser-v${V_NAME}-Release.apk \ "$APK" fi if [ -n "$AAB" ]; then - cp "$AAB" release_out/GothwadTVBrowser-v${V_NAME}-PlayStore.aab + cp "$AAB" release_out/BansifyBrowser-v${V_NAME}-PlayStore.aab jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 \ -keystore "$KS_PATH" \ -storepass "$KEYSTORE_PASS" -keypass "$KEY_PASS" \ - release_out/GothwadTVBrowser-v${V_NAME}-PlayStore.aab \ + release_out/BansifyBrowser-v${V_NAME}-PlayStore.aab \ "$ACTUAL_ALIAS" fi @@ -159,6 +159,6 @@ jobs: prerelease: false generate_release_notes: true files: | - release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk - release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk - release_out/GothwadTVBrowser-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab + release_out/BansifyBrowser-v${{ steps.versioning.outputs.v_name }}-Release.apk + release_out/BansifyBrowser-v${{ steps.versioning.outputs.v_name }}-Debug.apk + release_out/BansifyBrowser-v${{ steps.versioning.outputs.v_name }}-PlayStore.aab