Skip to content

Commit

Permalink
Fixes GitHub workflow variable references.
Browse files Browse the repository at this point in the history
  • Loading branch information
metroid-samus committed Mar 7, 2024
1 parent 8f26f46 commit bb00cf5
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,18 @@ jobs:
pytest --junitxml=junit/test-results.xml --cov=dispatch --cov-report=json:coverage.json --cov-report=xml --cov-report=html
export COVERAGE_TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
export FAILED_COVERAGE_PER_FILE=$(python -c "import json;from pprint import pprint;files=json.load(open('coverage.json'))['files'];covs=map(lambda k, v: (k, v['summary']['percent_covered_display']),files.keys(),files.values()); pprint(list(filter(lambda cov:int(cov[1])<${{ env.COVERAGE_SINGLE }},covs)))")
- name: pytester-cov
id: pytester-cov
uses: programmingwithalex/pytester-cov@main
with:
pytest-root-dir: '.'
cov-threshold-single: ${{ env.COVERAGE_SINGLE }}
cov-threshold-total: ${{ env.COVERAGE_TOTAL }}
- name: Coverage single fail - exit
- name: Coverage per file
# TODO: Change this recommendation into a requirement.
if: ${{ steps.pytester-cov.outputs.cov-threshold-single-fail == 'true' }}
run: |
echo "FAIL Recommended file(s) test coverage of ${{ env.COVERAGE_SINGLE }}% not reached."
echo "Failed file coverage(s): $FAILED_COVERAGE_PER_FILE"
# exit 1
- name: Coverage total fail - exit
if [[ $FAILED_COVERAGE_PER_FILE < ${{ env.COVERAGE_SINGLE }} ]]; then
echo "FAIL Recommended file(s) test coverage of ${{ env.COVERAGE_SINGLE }}% not reached."
echo "Failed file coverage(s): $FAILED_COVERAGE_PER_FILE"
# exit 1
fi
- name: Coverage total
# TODO: Change this recommendation into a requirement.
if: ${{ steps.pytester-cov.outputs.cov-threshold-total-fail == 'true' }}
run: |
echo "FAIL Recommended total test coverage of ${{ env.COVERAGE_TOTAL }}% not reached. Total coverage: $COVERAGE_TOTAL"
# exit 1
if [[ $COVERAGE_TOTAL < ${{ env.COVERAGE_TOTAL }} ]]; then
echo "FAIL Recommended total test coverage of ${{ env.COVERAGE_TOTAL }}% not reached. Total coverage: $COVERAGE_TOTAL"
# exit 1
fi

0 comments on commit bb00cf5

Please sign in to comment.