Skip to content

Commit

Permalink
Add windows support by removing POSIX line seperator normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Sep 16, 2024
1 parent e65b174 commit f6f0aa0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ on:

jobs:
scala:
runs-on: ubuntu-latest
strategy:
fail-fast: false # remove when PR is finished, just to make sure we don't make regression
matrix:
JDK: [ 8, 17 ]
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}

steps:
- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
shell: bash
run: git config --global core.autocrlf false

- name: checkout the repo
uses: actions/checkout@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CoberturaMultiSourceReader(

protected def lineCoverage(sourceFile: String) = {
val filenamePath =
splitPath(new File(sourceFile))._2.replace(File.separator, "/")
splitPath(new File(sourceFile))._2

lineCoverageMap(filenamePath)
}
Expand All @@ -130,9 +130,7 @@ class CoberturaMultiSourceReader(
val lineHitMap = lineCoverage(source)
val fullLineHit = (0 until lineCount).map(i => lineHitMap.get(i + 1))

val sourceNormalized = source.replace(File.separator, "/")

SourceFileReport(sourceNormalized, fullLineHit.toList)
SourceFileReport(source, fullLineHit.toList)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ class CoverallPayloadWriter(
}

def addSourceFile(report: SourceFileReport) = {
val repoRootDirStr =
repoRootDir.getCanonicalPath.replace(File.separator, "/") + "/"
val repoRootDirStr = repoRootDir.getCanonicalPath + File.separator

// create a name relative to the project root (rather than the module root)
// this is needed so that coveralls can find the file in git.
Expand Down

0 comments on commit f6f0aa0

Please sign in to comment.