Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
*.apk filter=lfs diff=lfs merge=lfs -text

#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary
53 changes: 53 additions & 0 deletions .github/workflows/PerformanceCheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Performance Check

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
benchmark-android:
uses: Frozen-Bytes/workflow-testing/.github/workflows/android-macrobenchmark-gradle.yml@main
strategy:
fail-fast: false
matrix:
include:
- name: "Pixel"
profile: "pixel"
name: ${{ matrix.name }}
with:
api-level: 34
target: google_apis
arch: x86_64
profile: "${{ matrix.profile }}"
gradle-cache-readonly: false
baseline-branch: "main"
candidate-branch: "${{ github.head_ref }}"
runs: 5
args: "--verbose --all-methods --measures TID FFO MEM_RSS_MAX --aggregate median --fit 5"
instrument-args: "-e package com.google.samples.apps.nowinandroid.Generator"
artifact-name: "benchcomp-${{ matrix.name }}.json"
artifact-macrobenchmark-name: "${{ matrix.name }}-raw-macrobenchmark"
device-alias: "${{ matrix.name }}"

publish-report:
runs-on: ubuntu-latest
needs: benchmark-android
permissions:
pull-requests: write
contents: read

steps:
- name: Create Bot Token
id: app-token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ vars.GH_APP_CLIENT_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}

- name: Publish Report
uses: Frozen-Bytes/actions/publish-report@v3
with:
github-token: ${{ steps.app-token.outputs.token }}
artifact-prefix: "benchcomp-"
comment-on-pr: ${{ github.event_name == 'pull_request' && 'true' || 'false' }}
248 changes: 248 additions & 0 deletions .github/workflows/android-macrobenchmark-gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
name: Android Macrobenchmark CI (Gradle)

on:
workflow_call:
inputs:
api-level:
description: 'API level of the platform and system image - e.g. 23, 33, 35-ext15, Baklava'
required: true
type: string
system-image-api-level:
description: 'API level of the system image - e.g. 34-ext10, 35-ext15. If not set the `api-level` input will be used.'
required: false
type: string
target:
description: 'target of the system image - e.g. default, google_apis, google_apis_ps16k, google_apis_playstore, google_apis_playstore_16k, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv, google-tv, android-automotive, android-automotive-playstore or android-desktop'
default: 'default'
type: string
arch:
description: 'CPU architecture of the system image - x86, x86_64 or arm64-v8a'
default: 'x86'
type: string
profile:
description: 'hardware profile used for creating the AVD - e.g. `Nexus 6`'
type: string
cores:
description: 'the number of cores to use for the emulator'
default: 2
type: string
ram-size:
description: 'size of RAM to use for this AVD, in KB or MB, denoted with K or M. - e.g. `2048M`'
type: string
heap-size:
description: 'size of heap to use for this AVD in MB. - e.g. `512M`'
type: string
sdcard-path-or-size:
description: 'path to the SD card image for this AVD or the size of a new SD card image to create for this AVD, in KB or MB, denoted with K or M. - e.g. `path/to/sdcard`, or `1000M`'
type: string
disk-size:
description: 'disk size to use for this AVD. Either in bytes or KB, MB or GB, when denoted with K, M or G'
type: string
avd-name:
description: 'custom AVD name used for creating the Android Virtual Device'
default: 'test'
type: string
force-avd-creation:
description: 'whether to force create the AVD by overwriting an existing AVD with the same name as `avd-name` - `true` or `false`'
default: 'true'
type: string
emulator-boot-timeout:
description: 'Emulator boot timeout in seconds. If it takes longer to boot, the action would fail - e.g. `300` for 5 minutes'
default: '600'
type: string
emulator-port:
description: 'Port to run emulator on, allows to run multiple emulators on the same physical machine'
default: '5554'
type: string
emulator-options:
description: 'command-line options used when launching the emulator - e.g. `-no-window -no-snapshot -camera-back emulated`'
default: '-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim'
type: string
disable-animations:
description: 'whether to disable animations - true or false'
default: 'true'
type: string
disable-spellchecker:
description: 'whether to disable the Android spell checker framework, a common source of flakiness in text fields - `true` or `false`'
default: 'false'
type: string
disable-linux-hw-accel:
description: 'whether to disable hardware acceleration on Linux machines - `true` or `false` or `auto`'
default: 'auto'
type: string
enable-hw-keyboard:
description: 'whether to enable hardware keyboard - `true` or `false`.'
default: 'false'
type: string
emulator-build:
description: 'build number of a specific version of the emulator binary to use - e.g. `6061023` for emulator v29.3.0.0'
type: string
working-directory:
description: 'A custom working directory - e.g. `./android` if your root Gradle project is under the `./android` sub-directory within your repository'
type: string
ndk:
description: 'version of NDK to install - e.g. 21.0.6113669'
type: string
cmake:
description: 'version of CMake to install - e.g. 3.10.2.4988404'
type: string
channel:
description: 'Channel to download the SDK components from - `stable`, `beta`, `dev`, `canary`'
default: 'stable'
type: string
pre-emulator-launch-script:
description: 'custom script to run after creating the AVD and before launching the emulator - e.g. `./adjust-emulator-configs.sh`'
type: string

# Build Options
baseline-branch:
type: string
default: main
candidate-branch:
type: string
default: ""
gradle-cache-readonly:
description: |
When 'true', existing entries will be read from the cache but no entries will be written.
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
required: false
default: ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}
type: boolean

# Benchmark.sh Options
runs:
description: 'Number of benchmark iterations (passed to --runs)'
default: '1'
type: string
retry:
description: 'Number of times to retry the benchmark on failure'
default: '3'
type: string
instrument-args:
description: 'Extra arguments passed to instrumentation runner'
default: ''
type: string

# Benchcomp Options
args:
description: 'Arguments passed directly to benchcomp'
default: '--verbose -A -a'
type: string
device-alias:
description: 'Attach an alias to the AVD device identifier'
default: ''
type: string

# Artifacts
artifact-name:
description: 'Name of the uploaded benchcomp result artifact'
default: 'benchcomp.json'
type: string
artifact-macrobenchmark-name:
description: 'Name of the uploaded raw MacroBenchmark results'
default: 'raw-macrobenchmarks'
type: string
upload-macrobenchmark:
description: 'Whether to upload raw MacroBenchmark results'
default: 'true'
type: string

jobs:
benchmark-android:
runs-on: ubuntu-latest

steps:
- name: Free Disk Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"

- name: Enable KVM
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 (Baseline)
uses: actions/checkout@v4
with:
ref: ${{ inputs.baseline-branch }}
path: baseline

- name: Checkout branch (Candidate)
uses: actions/checkout@v4
with:
ref: ${{ (inputs.candidate-branch != '' && inputs.candidate-branch) || (github.head_ref != '' && github.head_ref) || github.ref_name }}
path: candidate

- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "17"

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
# By default, The setup-gradle action will only write to the cache from Jobs on the default (main/master) branch.
# Jobs on other branches will read entries from the cache but will not write updated entries.
cache-read-only: ${{ inputs.gradle-cache-readonly }}

- name: Build APKs (Candidate)
working-directory: ./candidate
run: |
chmod +x ./gradlew
./gradlew :benchmarks:assembleDebug

- name: List Dirs (Candidate)
working-directory: ./candidate
run: ls -alR

- name: Android Macrobenchmark CI
uses: Frozen-Bytes/actions/android-macrobenchmark-ci@v3
with:
# Emulator Options
api-level: ${{ inputs.api-level }}
system-image-api-level: ${{ inputs.system-image-api-level }}
target: ${{ inputs.target }}
arch: ${{ inputs.arch }}
profile: ${{ inputs.profile }}
cores: ${{ inputs.cores }}
ram-size: ${{ inputs.ram-size }}
heap-size: ${{ inputs.heap-size }}
sdcard-path-or-size: ${{ inputs.sdcard-path-or-size }}
disk-size: ${{ inputs.disk-size }}
avd-name: ${{ inputs.avd-name }}
force-avd-creation: ${{ inputs.force-avd-creation }}
emulator-boot-timeout: ${{ inputs.emulator-boot-timeout }}
emulator-port: ${{ inputs.emulator-port }}
emulator-options: ${{ inputs.emulator-options }}
disable-animations: ${{ inputs.disable-animations }}
disable-spellchecker: ${{ inputs.disable-spellchecker }}
disable-linux-hw-accel: ${{ inputs.disable-linux-hw-accel }}
enable-hw-keyboard: ${{ inputs.enable-hw-keyboard }}
emulator-build: ${{ inputs.emulator-build }}
working-directory: ${{ inputs.working-directory }}
ndk: ${{ inputs.ndk }}
cmake: ${{ inputs.cmake }}
channel: ${{ inputs.channel }}
pre-emulator-launch-script: ${{ inputs.pre-emulator-launch-script }}

# Benchmark.sh Inputs (Required)
baseline-apk: "./baseline/apks/org.wikipedia_r_50595.apk"
candidate-apk: "./candidate/apks/org.wikipedia_r_50595.apk"
benchmark-apk: "./candidate/benchmarks/build/outputs/apk/debug/benchmarks-debug.apk"
# Benchmark.sh Options
runs: ${{ inputs.runs }}
retry: ${{ inputs.retry }}
instrument-args: ${{ inputs.instrument-args }}

# Benchcomp Options
args: ${{ inputs.args }}
device-alias: "${{ inputs.device-alias }}"

# Artifacts
artifact-name: "${{ inputs.artifact-name }}"
artifact-macrobenchmark-name: "${{ inputs.artifact-macrobenchmark-name }}"
upload-macrobenchmark: ${{ inputs.upload-macrobenchmark }}
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

# Ignore Kotlin plugin data
.kotlin

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/
out/
build/
generated/

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
.classpath
.project

# Windows thumbnail db
.DS_Store

# IDEA/Android Studio project files, because
# the project can be imported from settings.gradle.kts
*.iml
.idea/*
!.idea/copyright
# Keep the code styles.
!/.idea/codeStyles
/.idea/codeStyles/*
!/.idea/codeStyles/Project.xml
!/.idea/codeStyles/codeStyleConfig.xml

# Gradle cache
.gradle

# Sandbox stuff
_sandbox

# Android Studio captures folder
captures/

# Kotlin
.kotlin
Loading
Loading