Skip to content

Merge pull request #7 from cmayes/specify_sub_groups #96

Merge pull request #7 from cmayes/specify_sub_groups

Merge pull request #7 from cmayes/specify_sub_groups #96

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
pull_request:
permissions:
contents: read
jobs:
tests:
strategy:
fail-fast: false
matrix:
# Poetry 1.2.x wants Python 3.10
python-version: [ "3.10", "3.11", "3.12" ]
poetry-version: [ "1.2.2", "1.6.1" ]
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: Gr1N/setup-poetry@v8
with:
poetry-version: ${{ matrix.poetry-version }}
- uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: |
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test and coverage with pytest
run: |
poetry run coverage run -m pytest
poetry run coverage report -m
poetry run coverage json
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: covdata
path: coverage.json
coverage:
name: Coverage
needs: tests
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.2.2"
- uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: |
poetry install
- name: Download coverage data
uses: actions/download-artifact@v3
with:
name: covdata
- name: Combine
run: |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['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.6.0
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
auth: ${{ secrets.GIST_TOKEN }}
gistID: 3c8214e2bd942821496440b93acd3582
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}