diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml new file mode 100644 index 0000000000..66284e7e33 --- /dev/null +++ b/.github/workflows/benchmarks.yml @@ -0,0 +1,65 @@ +name: Benchmarks +on: + schedule: + - cron: '0 1 * * *' # nightly build + workflow_dispatch: + +jobs: + + benchmark: + name: Build and Test + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v4 + - name: Set Java up in the runner + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + cache: 'maven' + - name: Setup Maven + uses: s4u/setup-maven-action@v1.8.0 + with: + java-version: 8 + - name: Install missing dependencies to container + run: | + sudo apt update + sudo apt install -y stunnel make git gcc + - name: Maven offline + run: | + mvn -q dependency:go-offline + - name: Clean environment + run: | + make cleanup + env: + JVM_OPTS: -Xmx3200m + TERM: dumb + - name: Start servers + run: | + make start + - name: Run benchmarks + run: | + mvn -Pjmh clean test + env: + JVM_OPTS: -Xmx3200m + TERM: dumb + # Download previous benchmark result from cache (if exists) + - name: Download previous benchmark data + uses: actions/cache@v4 + with: + path: ./cache + key: ${{ runner.os }}-benchmark + # Run `github-action-benchmark` action + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + # What benchmark tool the output.txt came from + tool: 'jmh' + # Where the output from the benchmark tool is stored + output-file-path: benchmark.log + # Where the previous data file is stored + external-data-json-path: ./cache/benchmark.log + # Workflow will fail when an alert happens + fail-on-alert: true + # Upload the updated cache file for the next job by actions/cache diff --git a/pom.xml b/pom.xml index ddfc4877b2..710d1f3593 100644 --- a/pom.xml +++ b/pom.xml @@ -557,22 +557,6 @@ 1.20.1 test - - - - - org.openjdk.jmh - jmh-core - 1.37 - test - - - org.openjdk.jmh - jmh-generator-annprocess - 1.37 - test - - @@ -1165,7 +1149,7 @@ - jmh + jmh @@ -1177,13 +1161,29 @@ org.openjdk.jmh jmh-generator-annprocess - 1.37 + 1.21 test + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 8 + 8 + + + org.openjdk.jmh + jmh-generator-annprocess + 1.21 + + + + maven-surefire-plugin diff --git a/src/test/jmh/io/lettuce/core/JmhMain.java b/src/test/jmh/io/lettuce/core/JmhMain.java index d68804b808..c73690e347 100644 --- a/src/test/jmh/io/lettuce/core/JmhMain.java +++ b/src/test/jmh/io/lettuce/core/JmhMain.java @@ -32,6 +32,6 @@ private static void runRedisClientBenchmark() throws RunnerException { private static ChainedOptionsBuilder prepareOptions() { return new OptionsBuilder().forks(1).warmupIterations(5).threads(1).measurementIterations(5) - .timeout(TimeValue.seconds(2)); + .timeout(TimeValue.seconds(2)).output("benchmark.log"); } }