scoverage / sbt-coveralls

sbt-plugin to upload sbt-scoverage reports to coveralls
https://github.com/scoverage
Other
104 stars 50 forks source link

Getting key not found error when using github workflows #283

Closed gzoller closed 10 months ago

gzoller commented 11 months ago

I've got my ci.yml file exactly as recommended:

      - 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 }}

      - name: Generate coverage instrumentation and Test
        run: sbt clean coverage test 

      - name: Upload coverage data to Coveralls
        run: sbt coverageReport coveralls
        env:
          COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COVERALLS_FLAG_NAME: Scala ${{ matrix.scala }}

When my action runs I see this clip from the output, including the error:

[info] Written HTML coverage report [D:\a\listzipper\listzipper\target\scala-3.3.0\scoverage-report/index.html]
[info] Statement coverage.: 99.04%
[info] Branch coverage....: 100.00%
[info] Coverage reports completed
[info] All done. Coverage was stmt=[99.04%] branch=[100.00%]
[success] Total time: 2 s, completed Oct 4, 2023 4:56:46 PM
[info] Repository = .\.git
[info] sbt-coveralls: Generating reports for 2 files ...
[error] java.util.NoSuchElementException: key not found: co.blocke.collection/immutable/ListZipper.scala
[error]     at scala.collection.immutable.Map$Map2.apply(Map.scala:227)
[error]     at org.scoverage.coveralls.CoberturaMultiSourceReader.lineCoverage(CoberturaMultiSourceReader.scala:119)
[error]     at org.scoverage.coveralls.CoberturaMultiSourceReader.reportForSource(CoberturaMultiSourceReader.scala:130)
[error]     at org.scoverage.coveralls.CoverallsPlugin$.$anonfun$coverallsTask$6(CoverallsPlugin.scala:128)
[error]     at scala.collection.parallel.AugmentedIterableIterator.map2combiner(RemainsIterator.scala:116)
[error]     at scala.collection.parallel.AugmentedIterableIterator.map2combiner$(RemainsIterator.scala:113)
[error]     at scala.collection.parallel.immutable.ParHashSet$ParHashSetIterator.map2combiner(ParHashSet.scala:81)
[error]     at scala.collection.parallel.ParIterableLike$Map.leaf(ParIterableLike.scala:1064)
[error]     at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:[53](https://github.com/gzoller/listzipper/actions/runs/6409091896/job/17399539272?pr=12#step:7:54))
[error]     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error]     at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67)

You can see the coverage was properly calculated but blew up when it tried to push to coveralls.

The same 2 sbt commands in the ci.yml file, when run manually from the command line, run just fine.

If it would help to see the project: https://github.com/gzoller/listzipper/pull/12

rolandtritsch commented 11 months ago

Hi Greg. I will try to take a look at this this weekend.

rolandtritsch commented 11 months ago

image

Hi Greg. I can reproduce the problem with a fork of your repo. It works fine on ubuntu. The problem only shows itself on a windows env. I need to investigate this more.

The code coverage is not going to be different between windows and ubuntu. As a workaround I suggest you run the code coverage on ubuntu.

image

Take a look at the coverage.yml file in my fork.

gzoller commented 11 months ago

Cool, thanks! I'll have a look at your fork. This is a library, so I don't care at all Windows vs Ubuntu for my purposes, so happy to change it going forward.

rolandtritsch commented 10 months ago

Closing this for now. Let's reopen, if/when needed.