Skip to content

added --no-project to uv run in github action test #3

added --no-project to uv run in github action test

added --no-project to uv run in github action test #3

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 test dependencies
run: |
uv venv
uv pip install pytest pytest-cov toml psutil loguru requests PySide6
- name: Run tests with coverage
run: uv run --no-project 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 }}