Skip to content

Commit

Permalink
Move coverage out of default ci pipeline
Browse files Browse the repository at this point in the history
Coverage should not ge in default build pipline as the produced artifact
is published directly. Published library MUST not contain instrumented
bytecode.
  • Loading branch information
RustedBones committed Dec 6, 2023
1 parent ec35739 commit ba28ea9
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 20 deletions.
58 changes: 49 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,7 @@ jobs:
run: sbt githubWorkflowCheck

- name: Build project
if: matrix.scala == '2.13' && matrix.java == 'corretto@11'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' coverage test coverageAggregate

- name: Upload coverage report
if: matrix.scala == '2.13' && matrix.java == 'corretto@11'
run: 'bash <(curl -s https://codecov.io/bash)'

- name: Build project
if: '!(matrix.scala == ''2.13'' && matrix.java == ''corretto@11'' || matrix.scala == ''3'')'
if: '!(matrix.scala == ''3'')'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test

- name: Build project
Expand Down Expand Up @@ -270,6 +262,54 @@ jobs:

- run: scala-steward validate-repo-config .scala-steward.conf

coverage:
name: Test coverage
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.12]
java: [corretto@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

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

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

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

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

- name: Build project
if: matrix.scala == '2.13' && matrix.java == 'corretto@11'
run: sbt '++ ${{ matrix.scala }}' coverage test coverageAggregate

- name: Upload coverage report
if: matrix.scala == '2.13' && matrix.java == 'corretto@11'
run: 'bash <(curl -s https://codecov.io/bash)'

avro-legacy:
name: Test with legacy avro
strategy:
Expand Down
33 changes: 22 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,14 @@ ThisBuild / scalaVersion := scalaDefault
ThisBuild / crossScalaVersions := Seq(scala3, scala213, scala212)
ThisBuild / githubWorkflowTargetBranches := Seq("main")
ThisBuild / githubWorkflowJavaVersions := Seq(java17, java11)
ThisBuild / tlCiHeaderCheck := true
ThisBuild / tlCiScalafmtCheck := true
ThisBuild / tlCiMimaBinaryIssueCheck := true
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(
List("coverage", "test", "coverageAggregate"),
name = Some("Build project"),
cond = Some(coverageCond)
),
WorkflowStep.Run(
List("bash <(curl -s https://codecov.io/bash)"),
name = Some("Upload coverage report"),
cond = Some(coverageCond)
),
WorkflowStep.Sbt(
List("test"),
name = Some("Build project"),
cond = Some(s"!($coverageCond || $scala3Cond)")
cond = Some(s"!($scala3Cond)")
),
WorkflowStep.Sbt(
scala3Projects.map(p => s"$p/test"),
Expand All @@ -145,6 +138,24 @@ ThisBuild / githubWorkflowBuild := Seq(
)
)
ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
"coverage",
"Test coverage",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Sbt(
List("coverage", "test", "coverageAggregate"),
name = Some("Build project"),
cond = Some(coverageCond)
),
WorkflowStep.Run(
List("bash <(curl -s https://codecov.io/bash)"),
name = Some("Upload coverage report"),
cond = Some(coverageCond)
)
),
scalas = List(scalaDefault),
javas = List(javaDefault)
),
WorkflowJob(
"avro-legacy",
"Test with legacy avro",
Expand Down

0 comments on commit ba28ea9

Please sign in to comment.