From 5388724905a0fe6fb4dca9dcbb5aaaecd4010df8 Mon Sep 17 00:00:00 2001 From: tarao Date: Wed, 28 Feb 2024 16:29:43 +0900 Subject: [PATCH] Run CI for benchmarks. --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++++++ build.sbt | 26 ++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de1f6d3..8addbdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -299,6 +299,37 @@ jobs: modules-ignore: benchmark_3_3 benchmark_2_11_2.11 rootjs_3 docs_3 benchmark_2_13_2.13 rootjvm_3 rootnative_3 configs-ignore: test scala-tool scala-doc-tool test-internal + build-benchmark: + name: Build and Test Benchmarks + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@11] + project: [benchmark_2_11, benchmark_2_13, benchmark_3] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (fast) + uses: actions/checkout@v4 + + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update + + - name: sbt update (project) + run: sbt 'project ${{ matrix.project }}' update + + - name: Test + run: sbt 'project ${{ matrix.project }}' 'Jmh / run TimersBench' + coverage: name: Generate coverage report strategy: diff --git a/build.sbt b/build.sbt index fed9ff7..e387167 100644 --- a/build.sbt +++ b/build.sbt @@ -28,6 +28,7 @@ ThisBuild / githubWorkflowJavaVersions := Seq( JavaSpec.temurin("11"), JavaSpec.temurin("17"), ) +val BenchmarkJavaVersion = JavaSpec.temurin("11") val circeVersion = "0.14.6" val scalaTestVersion = "3.2.18" @@ -151,6 +152,31 @@ lazy val benchmark_2_11 = (project in file("modules/benchmark_2_11")) ), ) +ThisBuild / githubWorkflowAddedJobs ++= Seq( + WorkflowJob( + id = "build-benchmark", + name = "Build and Test Benchmarks", + javas = List(BenchmarkJavaVersion), + scalas = Nil, + matrixAdds = Map( + "project" -> List(benchmark_2_11.id, benchmark_2_13.id, benchmark_3.id), + ), + steps = List(WorkflowStep.Checkout) ++ WorkflowStep.SetupJava( + List(BenchmarkJavaVersion), + ) ++ githubWorkflowGeneratedCacheSteps.value ++ List( + WorkflowStep.Run( + name = Some("sbt update (project)"), + commands = List("sbt 'project ${{ matrix.project }}' update"), + ), + WorkflowStep.Run( + name = Some("Test"), + commands = + List("sbt 'project ${{ matrix.project }}' 'Jmh / run TimersBench'"), + ), + ), + ), +) + ThisBuild / githubWorkflowTargetBranches := Seq("master") ThisBuild / tlCiReleaseBranches := Seq() // publish only tags