Skip to content

Merge pull request #101 from diningphil/minor-additions #120

Merge pull request #101 from diningphil/minor-additions

Merge pull request #101 from diningphil/minor-additions #120

# 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: Test Python versions
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
exclude:
- os: macos-14
python-version: '3.8'
- os: macos-14
python-version: '3.9'
steps:
- uses: actions/checkout@v4
with:
node-version: '20'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
node-version: '20'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest coverage==7.4.4 coverage-badge
python -m pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --max-line-length=79 --show-source --statistics
- name: Pytest and Coverage badge
run: |
coverage run -m pytest tests/
coverage report -m
rm .badges/coverage_badge.svg
coverage-badge -o .badges/coverage_badge.svg
- name: Commit files
if: github.event_name == 'push'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .badges/coverage_badge.svg
git diff --exit-code || git commit -m "Update coverage_badge.svg" -a
- name: Push changes
if: github.event_name == 'push' && success()
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}