Skip to content

Increased test coverage, removed dead code, added coverage. #1

Increased test coverage, removed dead code, added coverage.

Increased test coverage, removed dead code, added coverage. #1

Workflow file for this run

name: Tests
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Install dependencies
run: uv sync --dev
- name: Run tests with coverage
run: uv run pytest --tb=short --cov-report=json:coverage.json
- name: Extract coverage percentage
if: github.ref == 'refs/heads/main'
id: coverage
run: |
COV=$(python -c "import json; print(int(json.load(open('coverage.json'))['totals']['percent_covered']))")
echo "percentage=$COV" >> "$GITHUB_OUTPUT"
if [ "$COV" -ge 90 ]; then echo "color=brightgreen" >> "$GITHUB_OUTPUT"
elif [ "$COV" -ge 75 ]; then echo "color=green" >> "$GITHUB_OUTPUT"
elif [ "$COV" -ge 60 ]; then echo "color=yellow" >> "$GITHUB_OUTPUT"
else echo "color=red" >> "$GITHUB_OUTPUT"; fi
- name: Update coverage badge
if: github.ref == 'refs/heads/main'
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: ${{ vars.COVERAGE_GIST_ID }}
filename: coverage.json
label: coverage
message: ${{ steps.coverage.outputs.percentage }}%
color: ${{ steps.coverage.outputs.color }}