Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Nov 29, 2023
1 parent 1cd5a97 commit 66b9f8c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .ci/publish_coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -e

trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR

ARTIFACT_FOLDER=$1

# are there any coverage files?

ARGS=""

for file in `ls $ARTIFACT_FOLDER`; do

ARGS="-a ${ARTIFACT_FOLDER}/${file}"

done

lcov $ARGS --output-file /tmp/coverage.info

genhtml -o /tmp/coverage_html /tmp/coverage.info | tee /tmp/coverage.log

COVERAGE_PCT=`cat /tmp/coverage.log | tail -n 1 | awk '{print $2}'`

echo "Coverage: $COVERAGE_PCT"
4 changes: 2 additions & 2 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ echo "$0: tests finished"
echo "$0: storing coverage data"

lcov --capture --directory ${WORKSPACE} --output-file /tmp/coverage.original
[ -e /tmp/coverage.original ] && lcov --remove /tmp/coverage.original "*/test/" --output-file /tmp/coverage.removed
[ -e /tmp/coverage.removed ] && lcov --extract /tmp/coverage.removed "*/${WORKSPACE}/*" --output-file $ARTIFACT_FOLDER/$REPOSITORY_NAME.info
lcov --remove /tmp/coverage.original "*/test/" --output-file /tmp/coverage.removed || echo "$0: coverage tracefile is empty"
lcov --extract /tmp/coverage.removed "*/${WORKSPACE}/*" --output-file $ARTIFACT_FOLDER/$REPOSITORY_NAME.info || echo "$0: coverage tracefile is empty"
7 changes: 7 additions & 0 deletions .github/workflows/rostest_to_release_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,10 @@ jobs:
run: |
ls -la /tmp/artifacts
.ci/publish_coverage.sh /tmp/artifacts
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: /tmp/coverage_html
allow_empty_commit: true
force_orphan: true

0 comments on commit 66b9f8c

Please sign in to comment.