Skip to content

Commit

Permalink
Merge pull request #31 from tarao/coverage
Browse files Browse the repository at this point in the history
Coverage report
  • Loading branch information
tarao authored Nov 13, 2023
2 parents 14949d0 + 8e51a16 commit 445ffaf
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,36 @@ jobs:
with:
modules-ignore: benchmark_3_3 benchmark_2_11_2.11 rootjs_3 benchmark_2_13_2.13 rootjvm_3 rootnative_3
configs-ignore: test scala-tool scala-doc-tool test-internal

coverage:
name: Generate coverage report
strategy:
matrix:
os: [ubuntu-latest]
scala: [3]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (fast)
uses: actions/checkout@v4

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
run: sbt +update

- run: sbt '++ ${{ matrix.scala }}' coverage rootJVM/test coverageAggregate

- env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
uses: codecov/codecov-action@v3
with:
flags: ${{matrix.scala}}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<img src="./record4s.svg" alt="" width="32"/> record4s: extensible records for Scala
====================================================================================
[![Build status](https://img.shields.io/github/actions/workflow/status/tarao/record4s/ci.yml)](https://github.com/tarao/record4s/actions/workflows/ci.yml)
[![Coverage status](https://codecov.io/gh/tarao/record4s/graph/badge.svg?token=U9309O1VNK)](https://codecov.io/gh/tarao/record4s)
27 changes: 27 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,30 @@ lazy val benchmark_2_11 = (project in file("modules/benchmark_2_11"))

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

ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
id = "coverage",
name = "Generate coverage report",
javas = List(githubWorkflowJavaVersions.value.last),
scalas = githubWorkflowScalaVersions.value.toList,
steps = List(WorkflowStep.Checkout) ++ WorkflowStep.SetupJava(
List(githubWorkflowJavaVersions.value.last),
) ++ githubWorkflowGeneratedCacheSteps.value ++ List(
WorkflowStep.Sbt(List("coverage", "rootJVM/test", "coverageAggregate")),
WorkflowStep.Use(
UseRef.Public(
"codecov",
"codecov-action",
"v3",
),
params = Map(
"flags" -> List("${{matrix.scala}}").mkString(","),
),
env = Map(
"CODECOV_TOKEN" -> "${{secrets.CODECOV_TOKEN}}",
),
),
),
),
)
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.1")
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % "0.6.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")

0 comments on commit 445ffaf

Please sign in to comment.