Skip to content

Merge branch 'main' of https://github.com/centre-for-humanities-compu… #396

Merge branch 'main' of https://github.com/centre-for-humanities-compu…

Merge branch 'main' of https://github.com/centre-for-humanities-compu… #396

Workflow file for this run

# This workflow will install Python dependencies, run pytests and run notebooks
# then it will in python 3.9 (ubuntu-latest) create a badge with the coverage
# and add it to the PR. This badge will be updated if the PR is updated.
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
pytest:
runs-on: ${{ matrix.os }}
permissions:
contents: read
issues: read
checks: write
pull-requests: write
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10"]
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }}-${{ matrix.python-version}}-${{ matrix.os }} @ ${{ github.ref }}"
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
id: setup_python
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
shell: bash
run: |
pip install .[tests]
- name: Run and write pytest
shell: bash
run: |
python -m pytest --durations=0 -x --junitxml=pytest.xml --cov-report=term-missing --cov=src/ tests/
- name: Test report on failures
uses: EnricoMi/publish-unit-test-result-action@v2
id: test_report_with_annotations
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' && github.actor != 'dependabot[bot]' && github.event_name == 'pull_request' && (success() || failure()) }} # Do not run for dependabot, run whether tests failed or succeeded
with:
comment_mode: "failures"
files: |
pytest.xml
- name: Pytest coverage comment
id: coverage-comment
uses: MishaKav/pytest-coverage-comment@main
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' && github.actor != 'dependabot[bot]' && github.event_name == 'pull_request' && (success() || failure()) }}
with:
create-new-comment: false
report-only-changed-files: true
pytest-coverage-path: pytest-coverage.txt
junitxml-path: ./pytest.xml