Android #53
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
run: | | |
APK_SIGNING_KEY_STORE_PATH="${PWD}/servo_keystore.jks" | |
echo "${KEYSTORE_BASE64}" | base64 -d > "${APK_SIGNING_KEY_STORE_PATH}" | |
echo "APK_SIGNING_KEY_STORE_PATH=${APK_SIGNING_KEY_STORE_PATH}" >> ${GITHUB_ENV} | |
- name: Build (arch ${{ matrix.arch }} profile ${{ inputs.profile }}) | |
env: | |
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} | |
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: | | |
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 |