Skip to content

Commit

Permalink
chore: add report visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina committed Apr 29, 2024
1 parent 7227d77 commit d9851eb
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/benchmarks-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Benchmark Checks
on:
# schedule:
# - cron: '00 8 * * 1' # every Monday at 8:00
workflow_dispatch:

jobs:
benchmarks-check:
runs-on: ubuntu-22.04
container: wirebot/cryptobox:1.4.0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Run Benchmarks
run: ./gradlew benchmark
- name: Generate HTML Report
run: ./gradlew jmhReport
- name: Archive Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmarks-reports
path: ./benchmarks/build/reports/benchmarks/**

- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
11 changes: 11 additions & 0 deletions benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ plugins {
kotlin("multiplatform")
alias(libs.plugins.benchmark)
alias(libs.plugins.allOpen)
alias(libs.plugins.jhmReport)
}

group = "com.wire.kalium.benchmarks"
version = "0.0.1"

allOpen {
annotation("org.openjdk.jmh.annotations.State")
}
Expand Down Expand Up @@ -39,3 +43,10 @@ benchmark {
}
}
}

jmhReport {
val baseFolder = project.file("build/reports/benchmarks/main").absolutePath
val lastFolder = project.file(baseFolder).list()?.sortedArray()?.lastOrNull() ?: ""
jmhResultPath = "$baseFolder/$lastFolder/jvm.json"
jmhReportOutput = "$baseFolder/$lastFolder"
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ slf4js = "2.0.13"
dagCommand = "1.9.0"
benchmark = "0.4.10"
jmh = "1.37"
jmhReport = "0.9.6"

[plugins]
# Home-made convention plugins
Expand All @@ -82,6 +83,7 @@ sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
protobuf = { id = "com.google.protobuf", version.ref = "protobufCodegen" }
benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "benchmark" }
allOpen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
jhmReport = { id = "io.morethan.jmhreport", version.ref = "jmhReport" }

[bundles]
android = ["appCompat", "activityCompose", "work", "composeMaterial", "coroutinesAndroid", "ktor", "ktor-okHttp"]
Expand Down

0 comments on commit d9851eb

Please sign in to comment.