diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index a458905..8b5351e 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -15,7 +15,22 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + # https://github.com/scoverage/sbt-coveralls#github-actions-integration +# - name: Git checkout (merge) + - uses: actions/checkout@v3 +# if: github.event_name != 'pull_request' +# with: +# fetch-depth: 0 +# +# - name: Git checkout (PR) +# uses: actions/checkout@v3 +# if: github.event_name == 'pull_request' +# with: +# fetch-depth: 0 +# # see: https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout +# ref: ${{ github.event.pull_request.head.sha }} + ### + - uses: olafurpg/setup-scala@v13 - name: Cache sbt @@ -30,8 +45,8 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - name: test - run: sbt ";clean;Test/compile;test" + - name: run tests + run: sbt ";clean;Test/compile;coverage;test" - name: detailed test reporting uses: dorny/test-reporter@v1 @@ -56,8 +71,7 @@ jobs: job_summary: false - name: test coverage - # TODO: Use coveralls - run: echo "test coverage" + run: sbt coverageReport coveralls env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} diff --git a/README.md b/README.md index 5b112ec..9d988cc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Latest Release](https://badgen.net/github/release/NikinAI/TypedGraph)](https://github.com/NikinAI/TypedGraph/packages) +[![Coverage Status](https://coveralls.io/repos/github/NikinAI/TypedGraph/badge.svg?branch=main)](https://coveralls.io/github/NikinAI/TypedGraph?branch=main) + --- A library to describe **Typed Condensed Oriented Directed Acyclic Planar Multigraphs**. diff --git a/build.sbt b/build.sbt index eb99702..6293dec 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = project .in(file(".")) .enablePlugins(GitVersioning) -. enablePlugins(BuildInfoPlugin) + .enablePlugins(BuildInfoPlugin) .settings( scalaVersion := "2.13.10", name := "Typed Graph", @@ -26,13 +26,13 @@ lazy val root = "-Ywarn-unused:params", "-Ywarn-unused:locals", "-Ywarn-value-discard", "-Ywarn-unused:privates", ), - - + coverageEnabled := true, + CoverallsKeys.coberturaFile := crossTarget.value / "coverage-report" / "cobertura.xml", // https://github.com/target/data-validator/blob/d3ae90ea1c84d922e50ad097f517e44852711c1c/build.sbt#LL11-L12C27 git.useGitDescribe := true, // https://github.com/target/data-validator/blob/d3ae90ea1c84d922e50ad097f517e44852711c1c/build.sbt#LL27 - publishTo := githubPublishTo.value, + publishTo := githubPublishTo.value, // https://github.com/djspiewak/sbt-github-packages#usage githubOwner := "NikinAI", diff --git a/project/plugins.sbt b/project/plugins.sbt index a756beb..03714c2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,3 +4,8 @@ addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") // https://github.com/target/data-validator/blob/d3ae90ea1c84d922e50ad097f517e44852711c1c/project/plugins.sbt#LL3 addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") + +// https://github.com/scoverage/sbt-scoverage +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.5") +// https://github.com/scoverage/sbt-coveralls +addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.3")