Skip to content

Commit

Permalink
WIP: Attempting to fix coverage reports on coveralls
Browse files Browse the repository at this point in the history
They currently report aggregates but when you click on a file it
says path not found.
  • Loading branch information
cookpa committed Feb 18, 2024
1 parent b4a485e commit 97d382f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ on:
branches:
- master

workflow_dispatch:
inputs:
branch:
description: 'Branch name'
required: true

name: codecov

jobs:
Expand All @@ -18,8 +24,16 @@ jobs:
- name: Install coverage
run: python -m pip install coverage

- name: Find installed package path
id: find_package_path
run: >
echo "PACKAGE_PATH=$(python -c 'import importlib.util;
package_name=\"ants\"; package_spec=importlib.util.find_spec(package_name);
print(package_spec.submodule_search_locations[0] if package_spec else \"\")')"
>> $GITHUB_ENV
- name: Unit tests
run: tests/run_tests.sh -c
run: tests/run_tests.sh -c -s ${PACKAGE_PATH}

- name: Coveralls
uses: coverallsapp/github-action@v2
5 changes: 4 additions & 1 deletion tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ set -e

PYCMD=${PYCMD:="python3"}
COVERAGE=0
SOURCE="ants"
while [[ "$#" -gt 0 ]]; do
case "$1" in
-p|--python) PYCMD=$2; shift 2 ;;
-c|--coverage) COVERAGE=1; shift 1;;
-s|--source) SOURCE=$2; shift 2 ;;
--) shift; break ;;
*) echo "Invalid argument: $1!" ; exit 1 ;;
esac
done

if [[ $COVERAGE -eq 1 ]]; then
coverage erase
PYCMD="coverage run --parallel-mode --source ants "
PYCMD="coverage run --parallel-mode --source $SOURCE "
echo "coverage flag found. Setting command to: \"$PYCMD\""
fi

Expand Down Expand Up @@ -50,6 +52,7 @@ $PYCMD test_bugs.py $@
if [[ $COVERAGE -eq 1 ]]; then
coverage combine
coverage html
coverage xml
fi


Expand Down

0 comments on commit 97d382f

Please sign in to comment.