-
Notifications
You must be signed in to change notification settings - Fork 1
178 lines (151 loc) · 4.85 KB
/
mobile-bench.yml
File metadata and controls
178 lines (151 loc) · 4.85 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Mobile Bench (manual)
on:
workflow_dispatch:
inputs:
platform:
description: "android | ios | both"
required: false
default: "android"
permissions:
contents: read
jobs:
tests:
name: Host tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cargo test
run: cargo test --all
- name: Host benchmark summary
run: |
cargo run -p mobench -- run \
--target android \
--function sample_fns::fibonacci \
--iterations 5 \
--warmup 1 \
--local-only \
--output run-summary.json \
--summary-csv
- name: Publish host summary
if: ${{ always() }}
run: |
if [ -f run-summary.md ]; then
cat run-summary.md >> "$GITHUB_STEP_SUMMARY"
echo "::notice title=Host benchmark summary::Published to job summary"
fi
- name: Upload host summaries
uses: actions/upload-artifact@v4
with:
name: host-run-summary
path: |
run-summary.json
run-summary.md
run-summary.csv
android:
if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'both' || github.event.inputs.platform == '' }}
name: Android build (APK)
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-ndk
run: cargo install cargo-ndk
- name: Setup Android SDK/NDK
uses: android-actions/setup-android@v3
with:
packages: |
platform-tools
platforms;android-34
build-tools;34.0.0
ndk;26.1.10909125
- name: Build Android artifacts
run: cargo mobench build --target android
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
with:
gradle-version: 8.7
- name: Assemble APK
working-directory: target/mobench/android
run: gradle :app:assembleDebug
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: mobile-bench-android-apk
path: target/mobench/android/app/build/outputs/apk/debug/*.apk
ios:
if: ${{ github.event.inputs.platform == 'ios' || github.event.inputs.platform == 'both' || github.event.inputs.platform == '' }}
name: iOS xcframework
needs: tests
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-ios,aarch64-apple-ios-sim
- name: Build iOS xcframework + header
run: cargo mobench build --target ios
- name: Upload iOS artifacts
uses: actions/upload-artifact@v4
with:
name: mobile-bench-ios
path: target/mobench/ios/sample_fns.xcframework
browserstack:
name: BrowserStack run
needs: android
if: ${{ secrets.BROWSERSTACK_USERNAME != '' && secrets.BROWSERSTACK_ACCESS_KEY != '' }}
runs-on: ubuntu-latest
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-ndk
run: cargo install cargo-ndk
- name: Setup Android SDK/NDK
uses: android-actions/setup-android@v3
with:
packages: |
platform-tools
platforms;android-34
build-tools;34.0.0
ndk;26.1.10909125
- name: BrowserStack benchmark run
env:
ANDROID_NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/26.1.10909125
run: |
cargo run -p mobench -- run \
--target android \
--function sample_fns::fibonacci \
--iterations 5 \
--warmup 1 \
--devices "Pixel 7-13" \
--fetch \
--output run-summary.json \
--summary-csv
- name: Publish BrowserStack summary
if: ${{ always() }}
run: |
if [ -f run-summary.md ]; then
cat run-summary.md >> "$GITHUB_STEP_SUMMARY"
echo "::notice title=BrowserStack benchmark summary::Published to job summary"
fi
- name: Upload BrowserStack summaries
uses: actions/upload-artifact@v4
with:
name: browserstack-run-summary
path: |
run-summary.json
run-summary.md
run-summary.csv
target/browserstack