Update README.md #108
This file contains 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: test | |
on: | |
push: | |
pull_request: | |
branches: [main, master] | |
concurrency: | |
group: test-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
PYTHONUNBUFFERED: "1" | |
FORCE_COLOR: "1" | |
jobs: | |
tests: | |
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Hatch | |
run: python -m pip install --upgrade pip hatch | |
- name: Run style check | |
run: hatch run style:check | |
- name: Check types | |
run: hatch run types:check | |
- name: Run static analysis | |
run: hatch fmt --check | |
- name: Run tests | |
run: hatch run test.py${{ matrix.python-version }}:test-cov | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: covdata | |
path: .coverage.* | |
include-hidden-files: true | |
coverage: | |
name: Coverage | |
needs: | |
tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | |
python -m pip install --upgrade pip coverage[toml] | |
- name: Download coverage data | |
uses: actions/download-artifact@v3 | |
with: | |
name: covdata | |
- name: Combine | |
run: | | |
python -m compileall examples src tests | |
coverage combine | |
coverage report -i | |
coverage json -i | |
export TOTAL=$(cat coverage.json | jq -r .totals.percent_covered_display) | |
echo "total=${TOTAL}" >> $GITHUB_ENV | |
echo "### Total coverage: ${TOTAL} %" >> $GITHUB_STEP_SUMMARY | |
- name: Make badge | |
uses: schneegans/dynamic-badges-action@v1.7.0 | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 12a0c0616d67fc2b8b9cda9eda30be5d | |
filename: sliplib_coverage.svg | |
label: Coverage | |
message: ${{ env.total }} % | |
minColorRange: 50 | |
maxColorRange: 90 | |
valColorRange: ${{ env.total }} | |