Skip to content

Commit

Permalink
Adds shell script to report package code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
André Vants committed Oct 6, 2021
1 parent 8ff6fda commit eb8cd63
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

BIN_PATH="$(swift build --show-bin-path)"
XCTEST_PATH="$(find ${BIN_PATH} -name '*.xctest')"

COV_BIN=$XCTEST_PATH
if [[ "$OSTYPE" == "darwin"* ]]; then
f="$(basename $XCTEST_PATH .xctest)"
COV_BIN="${COV_BIN}/Contents/MacOS/$f"
fi

swift package clean
swift test --enable-code-coverage

llvm-cov report \
"${COV_BIN}" \
-instr-profile=.build/debug/codecov/default.profdata \
-ignore-filename-regex=".build|Tests" \
-use-color

0 comments on commit eb8cd63

Please sign in to comment.