Skip to content

Use the application registry as the default unit registry #91

Use the application registry as the default unit registry

Use the application registry as the default unit registry #91

Workflow file for this run

name: CI
on:
push:
branches:
- master
- main
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
tests:
if: ${{ !github.event.pull_request.draft }}
name: Tests
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
os:
- ubuntu-latest
# - macOS-latest
# - windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rye
uses: eifinger/setup-rye@v1
- name: Pin active Python
run: rye pin ${{ matrix.python-version }}
- name: Install dependencies
run: rye sync
- name: Run Tests
run: rye run coverage run -m pytest
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: .coverage.*
if-no-files-found: ignore
coverage:
if: ${{ !github.event.pull_request.draft }}
name: Combine coverage
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
# Use latest, so it understands all syntax.
python-version: "3.12"
- run: python -m pip install --upgrade coverage[toml]
- name: Download coverage data
uses: actions/download-artifact@v3
with:
name: coverage-data
- name: Combine coverage
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage json
TOTAL=$(python -c "import json;print(json.load(open('reports/coverage/coverage.json'))['totals']['percent_covered_display'])")
REPORT=$(python -m coverage report)
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "${REPORT}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload HTML report
uses: actions/upload-artifact@v3
with:
name: html-report
path: reports/coverage/html