fix #3 #75
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
if: >- | |
github.event.head_commit.author.email != 'auto@version' && | |
github.event.head_commit.committer.email != 'auto@version' | |
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.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install Hatch | |
run: | | |
pip install --upgrade pip | |
pip install hatch | |
- name: Run Linter | |
run: hatch run lint:all | |
- name: Run tests | |
run: hatch run +py=${{ matrix.python-version }} all:cov | |
- name: Combine | |
run: | | |
export COVERED_DISPLAY=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
echo "COVERED_DISPLAY=$COVERED_DISPLAY" >> $GITHUB_ENV | |
- name: Create the Badge | |
uses: schneegans/dynamic-badges-action@v1.6.0 | |
with: | |
auth: ${{ secrets.COVERAGE_TOKEN }} | |
gistID: c500a58a703c75a80014a92d8bf031f4 | |
filename: covbadge.json | |
label: coverage | |
message: ${{ env.COVERED_DISPLAY }}% | |
valColorRange: ${{ env.COVERED_DISPLAY }} | |
maxColorRange: 90 | |
minColorRange: 50 |