-
Notifications
You must be signed in to change notification settings - Fork 215
80 lines (69 loc) · 2.81 KB
/
generate-bp.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
name: Generate Baseline Profiles
on:
push:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
# This job checks for any file changed within MacrobenchmarkSample/ folder
# to distinguish if the build check for Macrobenchmark is needed to be run.
# It sets the outputs.macrobenchmark to true/false based on the changes.
# In the next build job, it checks for needs.changes.outputs.macrobenchmark == 'true'
# or skips the job otherwise.
changes:
if: github.repository_owner == 'android'
runs-on: ubuntu-latest
# Set job outputs to values from filter step to be able to use it in next job
outputs:
macrobenchmark: ${{ steps.filter.outputs.macrobenchmark }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
macrobenchmark:
- 'MacrobenchmarkSample/**'
baseline-profile:
needs: changes
# # Only run action for the main repo & not forks and if change is in macrobenchmark sample
if: github.repository_owner == 'android' && (needs.changes.outputs.macrobenchmark == 'true' || github.event_name == 'workflow_dispatch')
runs-on: macos-latest
timeout-minutes: 60
defaults:
run:
working-directory: ./MacrobenchmarkSample
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup JDK
id: setup-java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: "zulu"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Copy CI gradle.properties
working-directory: ./
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: Clean GMD
run: ./gradlew cleanManagedDevices --unused-only
# With the baseline profile Gradle plugin, release variants generate baseline profiles.
- name: Build production app
run: ./gradlew assembleRelease
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
-Pandroid.experimental.androidTest.numManagedDeviceShards=1
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1
- name: Upload app with Baseline Profile
uses: actions/upload-artifact@v3
with:
name: "Production App"
path: MacrobenchmarkSample/app/build/outputs/apk/release/*.apk