Skip to content

Fix pytest by including hidden files #14

Fix pytest by including hidden files

Fix pytest by including hidden files #14

Workflow file for this run

name: Pytest
on:
pull_request:
push:
branches: [ main ]
jobs:
pytest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "pypy3.9", "pypy3.10"]
exclude:
- os: macos-latest
python-version: "3.9"
- os: windows-latest
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install hatch
hatch env create dev
- name: Test with pytest
run: |
# Need relative files for the action to report, but it messes up mutmut
echo "[run]" >> .coveragerc
echo "relative_files = true" >> .coveragerc
cat .coveragerc
hatch run dev:pytest
env:
COVERAGE_FILE: ".coverage.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Store coverage file
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.${{ matrix.os }}.${{ matrix.python-version }}
include-hidden-files: true
coverage:
runs-on: ubuntu-latest
needs: pytest
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
id: download
with:
pattern: coverage-*
merge-multiple: true
- name: Re-add relative so the action is happy
run: |
echo "[run]" >> .coveragerc
echo "relative_files = true" >> .coveragerc
- name: Python Coverage Comment
uses: py-cov-action/[email protected]
with:
GITHUB_TOKEN: ${{ github.token }}
MERGE_COVERAGE_FILES: true