Skip to content

Commit

Permalink
- Final version of initial code coverage limits.
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpojer committed Jul 2, 2024
1 parent b4feb24 commit e6c5ed0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ jobs:
- name: Check changed files coverage
run: |
# Get the list of changed Python files
CHANGED_FILES_SRC=$(git diff --name-only --diff-filter=AMR ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '.py$')
echo "Changed Python files 1: $CHANGED_FILES_SRC"
CHANGED_FILES=$(git diff --name-only --diff-filter=AMR ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '.py$')
echo "Changed Python files: $CHANGED_FILES"
# Convert list to comma-delimited string
CHANGED_FILES=$(echo "$CHANGED_FILES_SRC" | awk '{printf "%s,", $0} END {print ""}' | sed 's/,$//')
echo "Changed Python files 2: $CHANGED_FILES"
CHANGED_FILES=$(echo "$CHANGED_FILES" | awk '{printf "%s,", $0} END {print ""}' | sed 's/,$//')
# Generate coverage report for changed files
CHANGED_FILES_REPORT = coverage report --include="$CHANGED_FILES"
echo "Changed Python files: $CHANGED_FILES_REPORT"
# Fail if the coverage for changed files is below threshold
coverage report --include="$CHANGED_FILES" | grep TOTAL | awk '{if ($4 < 80.0) exit 1}'
shell: bash
Expand Down

0 comments on commit e6c5ed0

Please sign in to comment.