Skip to content

Commit

Permalink
Merge branch 'release/t0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
mshdabiola committed Jun 22, 2024
2 parents 9254767 + 0fa4560 commit 6704a75
Show file tree
Hide file tree
Showing 278 changed files with 114,819 additions and 2,508 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Run all local screenshot tests (Roborazzi)
id: screenshotsverify
continue-on-error: true
run: ./gradlew verifyRoborazziDebug
run: ./gradlew verifyRoborazziFossReliantDebug

- name: Prevent pushing new screenshots if this is a fork
id: checkfork_screenshots
Expand All @@ -101,7 +101,7 @@ jobs:
id: screenshotsrecord
if: steps.screenshotsverify.outcome == 'failure' && github.event_name == 'pull_request'
run: |
./gradlew recordRoborazziDebug
./gradlew recordRoborazziFossReliantDebug
- name: Push new screenshots if available
uses: stefanzweifel/git-auto-commit-action@v5
Expand All @@ -114,17 +114,17 @@ jobs:
# Run local tests after screenshot tests to avoid wrong UP-TO-DATE. TODO: Ignore screenshots.
- name: Run local tests and create report
if: always()
run: ./gradlew testDebug
run: ./gradlew testFossReliantDebug
# Replace task exclusions with `-Pandroidx.baselineprofile.skipgeneration` when
# https://android-review.googlesource.com/c/platform/frameworks/support/+/2602790 landed in a
# release build

- name: Build all build type and flavor permutations
run: ./gradlew :composeApp:assemble :benchmarks:assemble
-x pixel6Api33NonMinifiedReleaseAndroidTest
-x pixel6Api33NonMinifiedBenchmarkAndroidTest
-x collectNonMinifiedReleaseBaselineProfile
-x collectNonMinifiedBenchmarkBaselineProfile
run: ./gradlew :composeApp:assembleFossReliant :benchmarks:assembleFossReliant
-x pixel6Api33FossReliantNonMinifiedReleaseAndroidTest
-x pixel6Api33FossReliantNonMinifiedBenchmarkAndroidTest
-x collectFossReliantNonMinifiedReleaseBaselineProfile
-x collectFossReliantNonMinifiedBenchmarkBaselineProfile

- name: Upload build outputs (APKs)
uses: actions/upload-artifact@v4
Expand All @@ -140,7 +140,7 @@ jobs:
path: '**/build/test-results/test*UnitTest/**.xml'

- name: Check lint
run: ./gradlew :composeApp:lintRelease
run: ./gradlew :composeApp:lintFossReliantRelease

- name: Upload lint reports (HTML)
if: always()
Expand All @@ -150,7 +150,7 @@ jobs:
path: '**/build/reports/lint-results-*.html'

- name: Check badging
run: ./gradlew checkReleaseBadging
run: ./gradlew checkFossReliantReleaseBadging

androidTest:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -191,7 +191,11 @@ jobs:
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v3
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Build projects and run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
Expand All @@ -201,17 +205,17 @@ jobs:
disable-animations: true
disk-size: 6000M
heap-size: 600M
script: ./gradlew connectedDebugAndroidTest --daemon
script: ./gradlew connectedFossReliantDebugAndroidTest --daemon

- name: Run local tests (including Roborazzi) for the combined coverage report (only API 30)
if: matrix.api-level == 30
# There is no need to verify Roborazzi tests to generate coverage.
run: ./gradlew testDebugUnitTest -Proborazzi.test.verify=false # Add Prod if we ever add JVM tests for prod
run: ./gradlew testFossReliantDebugUnitTest -Proborazzi.test.verify=false # Add Prod if we ever add JVM tests for prod

# Add `createProdDebugUnitTestCoverageReport` if we ever add JVM tests for prod
- name: Generate coverage reports for Debug variants (only API 30)
if: matrix.api-level == 30
run: ./gradlew createDebugCombinedCoverageReport
run: ./gradlew createFossReliantDebugCombinedCoverageReport

- name: Upload test reports
if: always()
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/deploy_foss_to_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Deploy Foss to github

on:
push:
tags:
- 't[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 120

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
ls /dev/kvm
- name: Checkout
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Install GMD image for baseline profile generation
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;aosp_atd;x86_64"

- name: Accept Android licenses
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true

- name: Remove Firebase References
run: |
sed -i -e '/mlkit/,+14d' -e '/google-services/d' -e '/firebase/d' build.gradle.kts
sed -i -e '/with(target) {/,/^ }/d' -e '/CrashlyticsExtension/d' build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt
sed -i -e '/androidx.dev/d' settings.gradle.kts
sed -i -e '/mlkit/,+14d' -e '/google-services/d' -e '/libs.firebase/d' build-logic/convention/build.gradle.kts
- name: Build release variant including baseline profile generation
run: ./gradlew generateFossReliantReleaseBaselineProfile
-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: Build release variant apk
run: ./gradlew :app:assembleFossReliantRelease

- name: Sign APK
uses: r0adkll/sign-android-release@v1.0.4
with:
releaseDirectory: app/build/outputs/apk/fossReliant/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"

- name: Draft Release
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
artifacts: "app/build/outputs/apk/**/**/**/*.apk,app/build/outputs/mapping/**/**/*.txt"
token: ${{ secrets.TOKEN }}
generateReleaseNotes: true
bodyFile: distribution/whatsnew/whatsnew-en-US
prerelease: false

73 changes: 73 additions & 0 deletions .github/workflows/deploy_play_to_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Deploy Play to github

on:
push:
tags:
- 't[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 120

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
ls /dev/kvm
- name: Checkout
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Install GMD image for baseline profile generation
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;aosp_atd;x86_64"

- name: Accept Android licenses
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true

- name: Build release variant including baseline profile generation
run: ./gradlew generateGooglePlayReleaseBaselineProfile
-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: Build release variant apk
run: ./gradlew :app:assembleGooglePlayRelease

- name: Sign APK
uses: r0adkll/sign-android-release@v1.0.4
with:
releaseDirectory: app/build/outputs/apk/googlePlay/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"

- name: Draft Release
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
artifacts: "app/build/outputs/apk/**/**/**/*.apk,app/build/outputs/mapping/**/**/*.txt"
token: ${{ secrets.TOKEN }}
generateReleaseNotes: true
bodyFile: distribution/whatsnew/whatsnew-en-US
prerelease: false

65 changes: 0 additions & 65 deletions .github/workflows/deploy_to_github.yml

This file was deleted.

17 changes: 9 additions & 8 deletions benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
*abiola 2022
*/
import com.mshdabiola.app.BuildType
import com.mshdabiola.app.configureFlavors

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("mshdabiola.android.test")
alias(libs.plugins.androidx.baselineprofile)
alias(libs.plugins.baselineprofile)
}

android {
Expand Down Expand Up @@ -43,13 +44,13 @@ android {
// Use the same flavor dimensions as the application to allow generating Baseline Profiles on prod,
// which is more close to what will be shipped to users (no fake data), but has ability to run the
// benchmarks on demo, so we benchmark on stable data.
// configureFlavors(this) { flavor ->
// buildConfigField(
// "String",
// "APP_FLAVOR_SUFFIX",
// "\"${flavor.applicationIdSuffix ?: ""}\""
// )
// }
configureFlavors(this) { flavor ->
buildConfigField(
"String",
"APP_FLAVOR_SUFFIX",
"\"${flavor.applicationIdSuffix ?: ""}\""
)
}

// testOptions.managedDevices.devices {
// create<ManagedVirtualDevice>("pixel6Api34") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import java.io.ByteArrayOutputStream
*/
val PACKAGE_NAME = buildString {
append("com.mshdabiola.skeletonapp")
// append(BuildConfig.APP_FLAVOR_SUFFIX)
append(BuildConfig.APP_FLAVOR_SUFFIX)
append(BuildConfig.APP_BUILD_TYPE_SUFFIX)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,29 @@
package com.mshdabiola.benchmarks.baselineprofile

import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.uiautomator.By
import com.mshdabiola.benchmarks.PACKAGE_NAME
import com.mshdabiola.benchmarks.detail.addNote
import com.mshdabiola.benchmarks.detail.goBack
import com.mshdabiola.benchmarks.main.goToDetailScreen
import com.mshdabiola.benchmarks.main.mainScrollNoteDownUp
import com.mshdabiola.benchmarks.startActivity
import com.mshdabiola.benchmarks.waitAndFindObject
import org.junit.Rule
import org.junit.Test

class GenerateBaselineProfile {
@get:Rule
val baselineProfileRule = BaselineProfileRule()
@get:Rule val baselineProfileRule = BaselineProfileRule()

@Test
fun generate() =
baselineProfileRule.collect(PACKAGE_NAME) {
startActivity()

device.waitAndFindObject(By.res("add"), 1000)
.click()
repeat(10) {
goToDetailScreen()
addNote()
goBack()
}

mainScrollNoteDownUp()
}
}
Loading

0 comments on commit 6704a75

Please sign in to comment.