Skip to content

Run GitHub actions on all branches #10

Run GitHub actions on all branches

Run GitHub actions on all branches #10

Workflow file for this run

name: Tests and Coverage
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov coverage coverage-badge faker numpy
pip install -e .
- name: Run tests with coverage
env:
MPLBACKEND: Agg
run: |
python -m pytest --cov=autobasedoc --cov-report=xml --cov-report=term-missing
- name: Generate coverage badge
if: matrix.python-version == '3.12'
run: |
coverage-badge -o coverage.svg
- name: Upload coverage to Codecov
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: true
- name: Commit coverage badge
if: matrix.python-version == '3.12' && github.ref == 'refs/heads/master'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add coverage.svg
git diff --staged --quiet || git commit -m "Update coverage badge"
git push