Skip to content

Merge pull request #30 from github/update-python-json-logger #72

Merge pull request #30 from github/update-python-json-logger

Merge pull request #30 from github/update-python-json-logger #72

Workflow file for this run

name: Pytest
on:
pull_request:
push:
branches: [ main ]
jobs:
pytest:
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
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
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:
name: 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: |
# Need relative files for the action to report, but it messes up mutmut
echo "[run]" >> .coveragerc
echo "relative_files = true" >> .coveragerc
- name: Python Coverage Comment
uses: py-cov-action/python-coverage-comment-action@b2eb38dd175bf053189b35f738f9207278b00925
with:
GITHUB_TOKEN: ${{ github.token }}
MERGE_COVERAGE_FILES: true
- 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
include-hidden-files: true