75 lines
1.6 KiB
YAML
75 lines
1.6 KiB
YAML
name: Pytest
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request: {}
|
|
|
|
jobs:
|
|
test:
|
|
name: Unit Tests
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-22.04, windows-latest, macos-latest]
|
|
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: pip
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pytest pytest-cov
|
|
pip install -r requirements.txt
|
|
|
|
- name: Test
|
|
run: |
|
|
pytest
|
|
|
|
coverage:
|
|
name: Coverage Summary
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
pull-requests: write
|
|
contents: read
|
|
|
|
if: github.event_name == 'pull_request'
|
|
strategy:
|
|
fail-fast: false
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.11"
|
|
cache: pip
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pytest pytest-cov
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run Coverage
|
|
run: |
|
|
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=semver | tee pytest-coverage.txt
|
|
|
|
- name: Comment Result Summary
|
|
uses: MishaKav/pytest-coverage-comment@main
|
|
with:
|
|
pytest-coverage-path: ./pytest-coverage.txt
|
|
junitxml-path: ./pytest.xml
|