Skip to content

Commit 304bd27

Browse files
committed
update coverage badge to be in static branch
1 parent 8c8b9e0 commit 304bd27

File tree

3 files changed

+50
-30
lines changed

3 files changed

+50
-30
lines changed

.github/workflows/on-pr.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737

3838
code-coverage-report:
3939
name: Code Coverage Report
40-
if: github.event_name == 'pull_request'
4140
runs-on: ubuntu-latest
4241
needs: validate-and-test
4342
permissions:

.github/workflows/update-coverage-badge.yaml

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,40 +62,61 @@ jobs:
6262
echo "color=red" >> $GITHUB_OUTPUT
6363
fi
6464
65-
- name: Setup GitHub CLI
65+
- name: Create Coverage Badge SVG
6666
if: github.event_name != 'pull_request'
67+
id: create_badge
6768
run: |
68-
gh auth setup-git
69-
env:
70-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
mkdir -p badges
70+
# Create SVG badge file
71+
cat > badges/coverage.svg << EOF
72+
<svg xmlns="http://www.w3.org/2000/svg" width="106" height="20">
73+
<linearGradient id="b" x2="0" y2="100%">
74+
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
75+
<stop offset="1" stop-opacity=".1"/>
76+
</linearGradient>
77+
<mask id="a">
78+
<rect width="106" height="20" rx="3" fill="#fff"/>
79+
</mask>
80+
<g mask="url(#a)">
81+
<path fill="#555" d="M0 0h61v20H0z"/>
82+
<path fill="#${{ steps.coverage.outputs.color }}" d="M61 0h45v20H61z"/>
83+
<path fill="url(#b)" d="M0 0h106v20H0z"/>
84+
</g>
85+
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
86+
<text x="30.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
87+
<text x="30.5" y="14">coverage</text>
88+
<text x="82.5" y="15" fill="#010101" fill-opacity=".3">${{ steps.coverage.outputs.percentage }}%</text>
89+
<text x="82.5" y="14">${{ steps.coverage.outputs.percentage }}%</text>
90+
</g>
91+
</svg>
92+
EOF
93+
echo "Created coverage badge SVG"
7194
72-
- name: Update README.md with Coverage Badge
95+
- name: Push Badge to Dedicated Branch
7396
if: github.event_name != 'pull_request'
7497
env:
7598
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7699
run: |
77-
# Create the shields.io URL with the coverage data
78-
BADGE_URL="https://img.shields.io/badge/coverage-${{ steps.coverage.outputs.percentage }}%25-${{ steps.coverage.outputs.color }}"
100+
BADGE_BRANCH="coverage-badge"
79101
80-
# Update the README.md file
81-
sed -i -E "s|(\!\[License\]\([^)]+\))|\1 \![Coverage]($BADGE_URL)|" README.md
102+
# Setup git
103+
git config --local user.email "[email protected]"
104+
git config --local user.name "Coverage Badge Action"
82105
83-
# Check if the README has been modified
84-
if git diff --exit-code README.md; then
85-
echo "No changes to README.md"
106+
# Try to fetch the badge branch, or create it if it doesn't exist
107+
if ! git fetch origin $BADGE_BRANCH; then
108+
# Create an orphan branch for the badge
109+
git checkout --orphan $BADGE_BRANCH
110+
git rm -rf .
86111
else
87-
# Create a new branch
88-
BRANCH_NAME="update-coverage-badge-$(date +%Y%m%d%H%M%S)"
89-
git config --local user.email "[email protected]"
90-
git config --local user.name "Update Coverage Badge Action"
91-
git checkout -b $BRANCH_NAME
92-
git add README.md
93-
git commit -m "docs: update test coverage badge"
94-
git push --set-upstream origin $BRANCH_NAME
95-
96-
# Create a pull request using GitHub CLI
97-
gh pr create --title "Update coverage badge" \
98-
--body "Automatically updates the test coverage badge in README.md" \
99-
--base main \
100-
--head $BRANCH_NAME
101-
fi
112+
git checkout $BADGE_BRANCH
113+
fi
114+
115+
# Copy over just the badge SVG
116+
mkdir -p badges
117+
cp ../badges/coverage.svg badges/
118+
119+
# Commit and push the badge
120+
git add badges/coverage.svg
121+
git commit -m "chore: update coverage badge [skip ci]" || echo "No changes to commit"
122+
git push origin $BADGE_BRANCH

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
1+
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) [![Coverage](https://github.com/NVIDIA/KAI-Scheduler/raw/coverage-badge/badges/coverage.svg)](https://github.com/NVIDIA/KAI-Scheduler/blob/main/.github/workflows/update-coverage-badge.yaml)
22
# KAI Scheduler
33
KAI Scheduler is a robust, efficient, and scalable [Kubernetes scheduler](https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/) that optimizes GPU resource allocation for AI and machine learning workloads.
44

@@ -73,7 +73,7 @@ To start scheduling workloads with KAI Scheduler, please continue to [Quick Star
7373
* Graceful rollout of Inference workloads (new revision update using queue temporary over-quota)
7474

7575
## Support and Getting Help
76-
Wed love to hear from you! Here's how to reach out:
76+
We'd love to hear from you! Here's how to reach out:
7777

7878
- Technical Questions, Bugs, and Feature Requests: Please open [an issue on GitHub](https://github.com/NVIDIA/KAI-scheduler/issues/new) for anything related to technical support, bug reports, or feature suggestions. This helps us track and address them efficiently.
7979
- For broader conversations, including roadmap planning, scheduling strategies, and working group coordination, join the [CNCF Slack workspace](https://communityinviter.com/apps/cloud-native/cncf) and visit the [#batch-wg](https://cloud-native.slack.com/archives/C02Q5DFF3MM) channel.

0 commit comments

Comments
 (0)