This repository was archived by the owner on Oct 20, 2025. It is now read-only.
replace poetry with uv in workflows #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python Coverage | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.11"] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup gcloud Auth | |
| uses: google-github-actions/auth@v1 | |
| with: | |
| credentials_json: "${{ secrets.GC_SERVICE_KEY }}" | |
| - name: Setup gcloud CLI | |
| uses: google-github-actions/setup-gcloud@main | |
| with: | |
| version: "412.0.0" | |
| project_id: ${{ secrets.GC_PROJECT_ID }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Set up Python3.x | |
| uses: actions/setup-python@v5 | |
| id: py | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --locked --all-extras --dev | |
| - name: Run tests | |
| run: | | |
| # Generate coverage report via tests. Does not matter if the tests | |
| # pass here; that's covered by dedicated actions. | |
| uv run coverage run --source blind_charging -m pytest || true | |
| - name: Generate coverage XML | |
| run: uv run coverage xml | |
| - name: Interpret coverage report | |
| uses: irongut/CodeCoverageSummary@v1.3.0 | |
| with: | |
| filename: coverage.xml | |
| badge: true | |
| fail_below_min: true | |
| format: markdown | |
| hide_branch_rate: false | |
| hide_complexity: true | |
| indicators: true | |
| output: both | |
| thresholds: '60 80' | |
| - name: Add Coverage PR Comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| recreate: true | |
| path: code-coverage-results.md | |
| - name: Upload coverage artifacts | |
| if: github.event_name == 'push' | |
| run: | | |
| # Get the badge URL from the first line of the coverage comment. | |
| BADGE_URL=$(cat code-coverage-results.md | head -1 | sed -r 's/.*\((.+)\).*/\1/') | |
| # Download the badge | |
| curl $BADGE_URL > badge.svg | |
| # Generate web assets for coverage report. | |
| uv run coverage html | |
| # Upload artifacts | |
| gsutil cp badge.svg gs://scpl-blind-charging/coverage/badge.svg | |
| # Remove any old static assets for coverage | |
| gsutil -m rm -r gs://scpl-blind-charging/coverage/www | |
| # Upload coverage static assets | |
| gsutil -m cp -z html,js,json,css,png -r htmlcov/* gs://scpl-blind-charging/coverage/www/ | |
| # Make sure no assets get cached | |
| gsutil -m setmeta -r -h "Cache-Control: private, max-age=0, no-transform, no-store, no-cache" gs://scpl-blind-charging/coverage/ | |
| # Publish all the artifacts | |
| gsutil -m acl ch -r -u AllUsers:R gs://scpl-blind-charging/coverage/ |