Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
tarao committed Feb 28, 2024
1 parent 5388724 commit 8d2918c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 24 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.11.12, 2.13.12, 3.3.1]
java: [temurin@11]
project: [benchmark_2_11, benchmark_2_13, benchmark_3]
runs-on: ${{ matrix.os }}
Expand All @@ -325,10 +326,28 @@ jobs:
run: sbt +update

- name: sbt update (project)
run: sbt 'project ${{ matrix.project }}' update
if: matrix.project == 'benchmark_2_11' && matrix.scala == '2.11.12'
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' update

- name: Test
run: sbt 'project ${{ matrix.project }}' 'Jmh / run TimersBench'
if: matrix.project == 'benchmark_2_11' && matrix.scala == '2.11.12'
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' 'Jmh / run TimersBench'

- name: sbt update (project)
if: matrix.project == 'benchmark_2_13' && matrix.scala == '2.13.12'
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' update

- name: Test
if: matrix.project == 'benchmark_2_13' && matrix.scala == '2.13.12'
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' 'Jmh / run TimersBench'

- name: sbt update (project)
if: matrix.project == 'benchmark_3' && matrix.scala == '3.3.1'
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' update

- name: Test
if: matrix.project == 'benchmark_3' && matrix.scala == '3.3.1'
run: sbt '++ ${{ matrix.scala }}' 'project ${{ matrix.project }}' 'Jmh / run TimersBench'

coverage:
name: Generate coverage report
Expand Down
61 changes: 39 additions & 22 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -152,30 +152,47 @@ 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 / githubWorkflowAddedJobs ++= {
val versions = Map(
(benchmark_2_11 / scalaVersion).value -> benchmark_2_11,
(benchmark_2_13 / scalaVersion).value -> benchmark_2_13,
(benchmark_3 / scalaVersion).value -> benchmark_3,
)

Seq(
WorkflowJob(
id = "build-benchmark",
name = "Build and Test Benchmarks",
javas = List(BenchmarkJavaVersion),
scalas = versions.keys.toList,
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 ++ versions.flatMap {
case (scala, project) =>
List(
WorkflowStep.Sbt(
name = Some("sbt update (project)"),
cond = Some(
s"matrix.project == '${project.id}' && matrix.scala == '${scala}'",
),
commands = List("project ${{ matrix.project }}", "update"),
),
WorkflowStep.Sbt(
name = Some("Test"),
cond = Some(
s"matrix.project == '${project.id}' && matrix.scala == '${scala}'",
),
commands =
List("project ${{ matrix.project }}", "Jmh / run TimersBench"),
),
)
},
),
),
)
)
}

ThisBuild / githubWorkflowTargetBranches := Seq("master")
ThisBuild / tlCiReleaseBranches := Seq() // publish only tags
Expand Down

0 comments on commit 8d2918c

Please sign in to comment.