|
| 1 | +name: Android engine |
| 2 | + |
| 3 | +# Track 3 (docs/mobile-architecture.md): native de-googled Chromium APK. |
| 4 | +# The `validate` job proves the build skeleton is wired on every push. The real |
| 5 | +# compile is a ~50GB checkout + hours on a large/self-hosted Linux runner, so |
| 6 | +# it is manual (workflow_dispatch) and opt-in. |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + paths: |
| 11 | + - 'apps/android-engine/**' |
| 12 | + - '.github/workflows/android-engine.yml' |
| 13 | + pull_request: |
| 14 | + paths: |
| 15 | + - 'apps/android-engine/**' |
| 16 | + - '.github/workflows/android-engine.yml' |
| 17 | + workflow_dispatch: |
| 18 | + inputs: |
| 19 | + real_build: |
| 20 | + description: 'Run the REAL Chromium build (needs a large/self-hosted Linux runner)' |
| 21 | + type: boolean |
| 22 | + default: false |
| 23 | + runner: |
| 24 | + description: 'Runner label for the real build' |
| 25 | + type: string |
| 26 | + default: ubuntu-latest |
| 27 | + target_cpu: |
| 28 | + description: 'Target CPU' |
| 29 | + type: choice |
| 30 | + options: [arm64, arm, x64] |
| 31 | + default: arm64 |
| 32 | + |
| 33 | +defaults: |
| 34 | + run: |
| 35 | + working-directory: apps/android-engine/chromium |
| 36 | + |
| 37 | +jobs: |
| 38 | + validate: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v5 |
| 42 | + |
| 43 | + - name: version.json parses + has required keys |
| 44 | + run: | |
| 45 | + node -e "const c=require('./config/version.json'); |
| 46 | + for (const k of ['chromiumVersion','ungoogledChromiumTag','targetOs','ninjaTargets']) |
| 47 | + if (c[k]===undefined) { console.error('missing key:',k); process.exit(1); } |
| 48 | + console.log('version.json OK — chromium', c.chromiumVersion, '→', c.ninjaTargets.join(', '));" |
| 49 | +
|
| 50 | + - name: GN arg files present |
| 51 | + run: test -f config/gn-args/common.gni && test -f config/gn-args/android.gni |
| 52 | + |
| 53 | + - name: Shell scripts parse (bash -n) |
| 54 | + run: | |
| 55 | + for s in scripts/*.sh; do bash -n "$s" && echo "ok $s"; done |
| 56 | +
|
| 57 | + - name: Scripts dry-run without TB_RUN (guard works) |
| 58 | + run: | |
| 59 | + for s in fetch sync apply-patches build package tor; do |
| 60 | + out="$(./scripts/$s.sh)" |
| 61 | + echo "$out" | grep -q 'dry-run' || { echo "guard failed: $s did not dry-run"; exit 1; } |
| 62 | + echo "guard ok: $s" |
| 63 | + done |
| 64 | +
|
| 65 | + build-apk: |
| 66 | + # Real, heavy build — opt-in via workflow_dispatch with real_build=true. |
| 67 | + if: github.event_name == 'workflow_dispatch' && inputs.real_build |
| 68 | + runs-on: ${{ inputs.runner }} |
| 69 | + timeout-minutes: 720 |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v5 |
| 72 | + - name: Toolchain note |
| 73 | + run: | |
| 74 | + echo "Building native Android Chromium (cpu=${{ inputs.target_cpu }})." |
| 75 | + echo "Requires ~50GB+ disk, many GB RAM, hours. GitHub-hosted runners" |
| 76 | + echo "will run out of disk — use a large self-hosted Linux runner." |
| 77 | + - name: fetch |
| 78 | + env: { TB_RUN: '1', TB_TARGET_CPU: '${{ inputs.target_cpu }}' } |
| 79 | + run: ./scripts/fetch.sh |
| 80 | + - name: sync |
| 81 | + env: { TB_RUN: '1', TB_TARGET_CPU: '${{ inputs.target_cpu }}' } |
| 82 | + run: ./scripts/sync.sh |
| 83 | + - name: apply-patches |
| 84 | + env: { TB_RUN: '1', TB_TARGET_CPU: '${{ inputs.target_cpu }}' } |
| 85 | + run: ./scripts/apply-patches.sh |
| 86 | + - name: build |
| 87 | + env: { TB_RUN: '1', TB_TARGET_CPU: '${{ inputs.target_cpu }}' } |
| 88 | + run: ./scripts/build.sh |
| 89 | + - name: package |
| 90 | + env: { TB_RUN: '1', TB_TARGET_CPU: '${{ inputs.target_cpu }}' } |
| 91 | + run: ./scripts/package.sh |
| 92 | + - uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: tronbrowser-android-${{ inputs.target_cpu }} |
| 95 | + path: ~/.cache/tronbrowser-android-chromium/dist/* |
| 96 | + if-no-files-found: warn |
0 commit comments