Skip to content

Android

Android #44

Workflow file for this run

name: Android
on:
workflow_call:
inputs:
profile:
required: false
default: "release"
type: string
workflow_dispatch:
inputs:
profile:
required: false
default: "release"
type: choice
options: ["release", "debug", "production"]
env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0
jobs:
build:
name: Android Build
runs-on: ubuntu-22.04
strategy:
matrix:
arch: ['aarch64-linux-android', 'armv7-linux-androideabi', 'i686-linux-android', 'x86_64-linux-android']
steps:
- uses: actions/checkout@v4
if: github.event_name != 'issue_comment' && github.event_name != 'pull_request_target'
with:
fetch-depth: 2
# This is necessary to checkout the pull request if this run was triggered
# via an `issue_comment` action on a pull request.
- uses: actions/checkout@v4
if: github.event_name == 'issue_comment' || github.event_name == 'pull_request_target'
with:
ref: refs/pull/${{ github.event.issue.number || github.event.number }}/head
fetch-depth: 2
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip virtualenv
- name: Bootstrap dependencies
run: sudo apt update && python3 ./mach bootstrap
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
packages: 'tools platform-tools platforms;android-33'
- name: Install Android NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
- name: Setup Key Store for APK Signing
env:
KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
APK_SIGNING_KEY_STORE_PATH: "servo_keystore.jks"
APK_SIGNING_KEY_STORE_PASS: ${{ secrets.APK_SIGNING_KEY_STORE_PASS }}
APK_SIGNING_KEY_ALIAS: ${{ secrets.APK_SIGNING_KEY_ALIAS }}
APK_SIGNING_KEY_PASS: ${{ secrets.APK_SIGNING_KEY_PASS }}
run: echo "${KEYSTORE_BASE64}" > "${APK_SIGNING_KEY_STORE_PATH}"
- name: Build (arch ${{ matrix.arch }} profile ${{ inputs.profile }})
env:
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
python3 ./mach build --use-crown --locked --android --target ${{ matrix.arch }} --${{ inputs.profile }}
cp -r target/cargo-timings target/cargo-timings-android-${{ matrix.arch }}
# TODO: This is disabled since APK crashes during startup.
# See https://github.com/servo/servo/issues/31134
# - name: Script tests
# run: ./mach test-android-startup
- name: Archive build timing
uses: actions/upload-artifact@v4
with:
name: cargo-timings-android-${{ matrix.arch }}
# Using a wildcard here ensures that the archive includes the path.
path: target/cargo-timings-*
- name: Upload APK artifact for mach package
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.profile }}-binary-android-${{ matrix.arch }}
path: target/android/${{ matrix.arch }}/${{ inputs.profile }}/servoapp.apk