Skip to content

add coverage to workflow (#8) #189

add coverage to workflow (#8)

add coverage to workflow (#8) #189

Workflow file for this run

name: Tests
on:
push:
branches:
- "main"
pull_request:
types: [opened, synchronize]
jobs:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.x"]
name: pytest ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up CPython ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m venv venv
source ./venv/bin/activate
pip install --upgrade pip setuptools wheel pytest setuptools-rust
pip install -U -r requirements_dev.txt
- name: Installing distribution (dev mode)
# this adds the .so to the inner lib files so we can test
run: |
source ./venv/bin/activate
python ./setup.py develop
- name: Run tests
shell: bash
run: |
source ./venv/bin/activate
PYTHONPATH="$(pwd)" pytest
coverage:
name: Coverage
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up CPython 3.12
uses: actions/setup-python@v2
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m venv venv
source ./venv/bin/activate
pip install --upgrade pip setuptools wheel pytest setuptools-rust
pip install -U -r requirements_dev.txt
- name: Installing distribution (dev mode)
# this adds the .so to the inner lib files so we can test
run: |
source ./venv/bin/activate
python ./setup.py develop
- name: Run tests
shell: bash
run: |
source ./venv/bin/activate
PYTHONPATH="$(pwd)" coverage run -m pytest
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v4
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt