Skip to content

Add JAX functionality #7

Add JAX functionality

Add JAX functionality #7

name: Update code coverage badge
on:
push:
branches:
main
paths:
- 'tensorhub/**'
- 'tests/**'
pull_request:
branches:
main
paths:
- 'tensorhub/**'
- 'tests/**'
jobs:
update_coverage:
name: "Update coverage badgeadge"
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: "Install Dependencies"
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -e .
- name: "Run Coverage and Generate Badge"
run: |
pytest .
coverage report
coverage xml
coverage html
genbadge coverage --input-file coverage.xml
- name: "Check if coverage-badge.svg Changed"
id: check_svg_change
run: |
if git diff --quiet -- exit-code -- coverage-badge.svg; then
echo "No changes in coverage-badge.svg"
echo "svg_changed=false" >> $GITHUB_ENV
else
echo "Changes detected in coverage-badge.svg"
echo "svg_changed=true" >> $GITHUB_ENV
fi
- name: "Commit and Push Changes"
if: env.svg_changed == 'true'
run: |
git config user.email "${{ github.run_id }}+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add coverage-badge.svg
git commit -m "gh-actions[bot]: update code coverage badge"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}