mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 11:06:56 +08:00
Create, collect and publish junit reports for static typing.
(cherry picked from commit fb8363afdf53d6656fe020dd08f9e91d9da45565)
This commit is contained in:
17
.github/workflows/CoverageCollection.yml
vendored
17
.github/workflows/CoverageCollection.yml
vendored
@@ -35,13 +35,13 @@ on:
|
||||
required: false
|
||||
default: '-r tests/requirements.txt'
|
||||
type: string
|
||||
test_directory:
|
||||
tests_directory:
|
||||
description: 'Path to the directory containing tests (test working directory).'
|
||||
required: false
|
||||
default: 'tests'
|
||||
type: string
|
||||
unittest_directory:
|
||||
description: 'Path to the directory containing unit tests (relative to test_directory).'
|
||||
description: 'Path to the directory containing unit tests (relative to tests_directory).'
|
||||
required: false
|
||||
default: 'unit'
|
||||
type: string
|
||||
@@ -122,16 +122,19 @@ jobs:
|
||||
- name: Collect coverage
|
||||
continue-on-error: true
|
||||
run: |
|
||||
cd ${{ inputs.test_directory }}
|
||||
[ 'x${{ inputs.coverage_config }}' != 'x' ] && PYCOV_ARGS='--cov-config=${{ inputs.coverage_config }}' || unset PYCOV_ARGS
|
||||
python -m pytest -rA --cov=. $PYCOV_ARGS ${{ inputs.unittest_directory }} --color=yes
|
||||
RELDIR="$(realpath --relative-to=${{ inputs.tests_directory }} .)"
|
||||
echo $RELDIR
|
||||
cd ${{ inputs.tests_directory }}
|
||||
[ 'x${{ inputs.coverage_config }}' != 'x' ] && PYCOV_ARGS="--cov-config=$RELDIR/${{ inputs.coverage_config }}" || unset PYCOV_ARGS
|
||||
echo python -m pytest -rA --cov=$RELDIR $PYCOV_ARGS ${{ inputs.unittest_directory }} --color=yes
|
||||
python -m pytest -rA --cov=$RELDIR $PYCOV_ARGS ${{ inputs.unittest_directory }} --color=yes
|
||||
|
||||
- name: Convert to cobertura format
|
||||
run: coverage xml
|
||||
run: coverage xml --data-file=${{ inputs.tests_directory }}/.coverage
|
||||
|
||||
- name: Convert to HTML format
|
||||
run: |
|
||||
coverage html -d ${{ steps.getVariables.outputs.coverage_report_html_directory }}
|
||||
coverage html --data-file=${{ inputs.tests_directory }}/.coverage -d ${{ steps.getVariables.outputs.coverage_report_html_directory }}
|
||||
rm ${{ steps.getVariables.outputs.coverage_report_html_directory }}/.gitignore
|
||||
|
||||
- name: 📤 Upload 'Coverage Report' artifact
|
||||
|
||||
Reference in New Issue
Block a user