Skip to content

Commit 7a21521

Browse files
committed
Use awk to extract coverage table in CI
Replace the sed extraction with an awk script that starts printing at the coverage header and stops when the "Coverage XML written to file" marker is seen, preventing extraneous trailing output from being appended to the GitHub job summary. Retains the code block wrapping and || true to avoid step failures, and includes minor whitespace cleanup in the workflow file.
1 parent 02d385e commit 7a21521

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/testing-ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,18 @@ jobs:
5757
run: |
5858
tox -q | tee tox-output.log
5959
60+
6061
- name: Append Coverage Summary to Job
6162
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
6263
shell: bash
6364
run: |
6465
echo "## Coverage Summary" >> "$GITHUB_STEP_SUMMARY"
6566
echo '```text' >> "$GITHUB_STEP_SUMMARY"
66-
# Pull the coverage table from tox output:
67-
sed -n '/^Name\s\+Stmts\s\+Miss\s\+Cover/,$p' tox-output.log >> "$GITHUB_STEP_SUMMARY" || true
67+
awk '
68+
/^Name[[:space:]]+Stmts[[:space:]]+Miss/ {p=1}
69+
p==1 {print}
70+
/^Coverage XML written to file/ {exit}
71+
' tox-output.log >> "$GITHUB_STEP_SUMMARY" || true
6872
echo '```' >> "$GITHUB_STEP_SUMMARY"
6973
7074
- name: Upload coverage to Codecov

0 commit comments

Comments
 (0)