Skip to content

ci: give reviewers visibility into coverage impact before merge #68

ci: give reviewers visibility into coverage impact before merge

ci: give reviewers visibility into coverage impact before merge #68

Workflow file for this run

---
name: Test
on: # yamllint disable-line rule:truthy
pull_request:
push:
branches: [main]
permissions:
contents: read
pull-requests: write
actions: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
# yamllint disable-line rule:line-length
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install uv
# yamllint disable-line rule:line-length
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
- name: Cache NLTK data
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/nltk_data
key: nltk-averaged-perceptron-tagger-punkt
- name: Run tests with coverage
run: |-
uv run --dev pytest \
tests/ --cov=git_commit_guard \
--cov-report=term-missing \
--cov-report=xml
- name: Upload coverage report
# yamllint disable-line rule:line-length
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-report
path: coverage.xml
retention-days: 90
- name: Post coverage comment
if: github.event_name == 'pull_request'
# yamllint disable-line rule:line-length
uses: MishaKav/pytest-coverage-comment@dd5b80bde6d16941f336518e92929e89069d8451 # v1.7.2
with:
pytest-xml-coverage-path: coverage.xml
title: Coverage report
default-branch: main
unique-id-for-comment: coverage