49 lines
1.1 KiB
YAML
49 lines
1.1 KiB
YAML
name: Unit Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- feature/refactor
|
|
pull_request: {}
|
|
|
|
jobs:
|
|
test:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-22.04
|
|
|
|
strategy:
|
|
matrix:
|
|
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: pytest
|
|
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
|
|
if: github.event_name == 'pull_request'
|
|
|
|
- name: Check results
|
|
run: |
|
|
grep -q "FAILED" pytest-coverage.txt && exit 1 || exit 0
|