-
Notifications
You must be signed in to change notification settings - Fork 11
106 lines (87 loc) · 3.88 KB
/
generate_baseline_profile.yml
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
name: Generate Baseline Profile
on:
workflow_dispatch:
workflow_call:
secrets:
token:
required: true
permissions:
contents: write
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Enable KVM group perms
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: Checkout Branch
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Read SDK version
run: |
# Read the version from gradle.properties
version=$(grep '^version' gradle.properties | cut -d'=' -f2 | tr -d '[:space:]')
# Set the version as an environment variable
echo "ANDROID_SDK_VERSION=${version}" >> "$GITHUB_ENV"
- name: Publish SDK to Maven local
run: ./gradlew pTML
- name: Checkout Swazzler
uses: actions/checkout@v4
with:
repository: embrace-io/embrace-swazzler3
token: ${{ secrets.GH_EMBRACE_SWAZZLER3_TOKEN }}
path: './embrace-swazzler3'
- name: Publish Swazzler to Maven local
working-directory: ./embrace-swazzler3
run: ./gradlew pTML
- name: Checkout Android SDK Benchmark
uses: actions/checkout@v4
with:
repository: embrace-io/android-sdk-benchmark
ref: main
path: ./android-sdk-benchmark
token: ${{ secrets.GH_ANDROID_SDK_TOKEN || secrets.token }} # NOTE: read android-sdk-benchmark
- name: Clean Managed Devices
working-directory: android-sdk-benchmark
run: ./gradlew cleanManagedDevices --unused-only
- name: Generate Baseline Profile
working-directory: android-sdk-benchmark
run: ./gradlew -Pswazzler_version=${{ env.ANDROID_SDK_VERSION }} :macrobenchmark:pixel6Api34BaselineProfileAndroidTest
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1
# Sets the Baseline Profile on its proper place so it gets correctly bundled into Play Store
- name: Move & Rename Baseline Profiles
run: cat android-sdk-benchmark/macrobenchmark/build/outputs/managed_device_android_test_additional_output/baselineprofile/pixel6Api34/BaselineProfileGenerator_startup-baseline-prof.txt
| grep '^[^[]*io/embrace/android/embracesdk' > embrace-android-sdk/src/main/baseline-prof.txt
- name: Create baseline profile PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'embrace-ci[bot]'
git config --global user.email 'embrace-ci@users.noreply.github.com'
branch=baseline-profile-${{ github.run_id }}
git checkout -b $branch
if [[ `git status --porcelain` ]]; then
git add embrace-android-sdk/src/main/baseline-prof.txt
git commit -m "Generate baseline profiles"
git push -f origin $branch
gh pr create \
--base main \
--head $branch \
--title "Generate baseline profile ${{ github.ref }}" \
--body "Baseline Profiles help guide optimization beyond app startup by providing common user interactions that improve app runtime from the first launch" \
--assignee ${{ github.actor }}
else
echo "No changes to commit"
fi