Repository navigation
162 lines (157 loc) · 6.41 KB
/
Copy pathandroid.yml
File metadata and controls
162 lines (157 loc) · 6.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Android
on:
workflow_call:
outputs:
artifact_ids:
value: ${{ jobs.build.outputs.artifact_ids }}
description: Comma-separated list of artifact IDs for the release artifacts
inputs:
profile:
required: false
default: "checked-release"
type: string
bencher:
required: false
default: false
type: boolean
workflow_dispatch:
inputs:
profile:
required: false
default: "checked-release"
type: choice
options: ["checked-release", "release", "debug", "production"]
bencher:
required: false
default: false
type: boolean
env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
CARGO_INCREMENTAL: 0
jobs:
build:
name: Android Build
runs-on: ubuntu-22.04
outputs:
artifact_ids: ${{ steps.artifact_ids.outputs.artifact_ids }}
strategy:
matrix:
target: ['aarch64-linux-android', 'armv7-linux-androideabi', 'x86_64-linux-android']
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: false
swap-storage: false
- uses: servo/ci-runners/actions/checkout@a05e7e830e3f4d4c71bdc5a38f003f052b72668c
- name: Install crown
run: cargo install --path support/crown
- name: Change Mirror Priorities
uses: ./.github/actions/apt-mirrors
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Bootstrap dependencies
timeout-minutes: 30
run: sudo apt update && ./mach bootstrap --yes --skip-lints --skip-nextest
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v4
with:
packages: 'tools platform-tools platforms;android-34'
- name: Install Android NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r28b
- name: Setup Gradle caches
uses: gradle/actions/setup-gradle@v4
- name: Trigger initial download of Gradle with retries
run: |
for i in {1..4}; do
./gradlew --version && break || { echo "Downloading Gradle failed (attempt $i)." && sleep $((3 ** $i)); };
done
working-directory: ./support/android/apk/
- name: Setup Key Store for APK Signing
env:
KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}
if: ${{ env.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.target }} 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: |
./mach build --use-crown --locked --target ${{ matrix.target }} --profile ${{ inputs.profile }}
mv target/cargo-timings target/cargo-timings-android-${{ matrix.target }}
# See https://github.com/ReactiveCircus/android-emulator-runner#running-hardware-accelerated-emulators-on-linux-runners
- name: Enable KVM group permissions
if: ${{ matrix.target == 'x86_64-linux-android' }}
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Android startup smoketest
if: ${{ matrix.target == 'x86_64-linux-android' }}
uses: reactivecircus/android-emulator-runner@v2
with:
# This should be kept in sync with the `android-sdk-min` version in `libs.versions.toml`.
# DO NOT INCREASE THIS without prior discussion on zulip!
api-level: 29
arch: x86_64
target: default
script: ./mach smoketest --target ${{ matrix.target }} --profile ${{ inputs.profile }}
- name: Archive build timing
uses: actions/upload-artifact@v7
with:
name: cargo-timings-android-${{ matrix.target }}-${{ inputs.profile }}
# Using a wildcard here ensures that the archive includes the path.
path: target/cargo-timings-*
if-no-files-found: error
- name: Upload APK artifact
uses: actions/upload-artifact@v7
id: upload-apk
with:
name: ${{ inputs.profile }}-binary-android-${{ matrix.target }}
path: target/${{ matrix.target }}/${{ inputs.profile }}/servoapp.apk
if-no-files-found: error
- name: Upload AAR artifact
uses: actions/upload-artifact@v7
id: upload-aar
with:
name: ${{ inputs.profile }}-library-android-${{ matrix.target }}
path: target/${{ matrix.target }}/${{ inputs.profile }}/servoview.aar
if-no-files-found: error
- name: Collect artifact IDs needed by the release workflow
if: matrix.target == 'aarch64-linux-android'
id: artifact_ids
shell: bash
run: |
echo "artifact_ids=${{steps.upload-apk.outputs.artifact-id}},${{steps.upload-aar.outputs.artifact-id}}" >> $GITHUB_OUTPUT
bencher:
needs: ["build"]
strategy:
matrix:
target: ['aarch64-linux-android', 'armv7-linux-androideabi', 'x86_64-linux-android']
if: ${{ inputs.bencher && inputs.profile != 'debug' && github.event_name != 'workflow_dispatch' && github.event_name != 'merge_group' }}
name: 'Bencher (${{ matrix.target }})'
uses: ./.github/workflows/bencher.yml
with:
target: android-${{ matrix.target }}
profile: ${{ inputs.profile }}
compressed-file-path: ${{ inputs.profile }}-binary-android-${{ matrix.target }}/servoapp.apk
binary-path: lib/${{ matrix.target == 'aarch64-linux-android' && 'arm64-v8a' || matrix.target == 'armv7-linux-androideabi' && 'armeabi-v7a' || matrix.target == 'x86_64-linux-android' && 'x86_64'}}/libservoshell.so
file-size: true
speedometer: false
dromaeo: false
secrets: inherit