Skip to content

Commit

Permalink
Add pyest github action.
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rowan committed Aug 23, 2024
1 parent 4a3a006 commit 87b9aa4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pr-run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test PRs

on:
pull_request:
jobs:
run-tests:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: poetry install --with tests
- name: Run tests
env:
REPORT_OUTPUT: md_report.md
shell: bash
run: |
echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV"
poetry run pytest -v --md-report --md-report-flavor gfm --md-report-exclude-outcomes passed skipped xpassed --md-report-output "$REPORT_OUTPUT"
- name: Render the report to the PR when tests fail
uses: marocchino/sticky-pull-request-comment@v2
if: failure()
with:
header: test-report
recreate: true
path: ${{ env.REPORT_FILE }}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mkdocs-material = "^9.5.29"
[tool.poetry.group.tests.dependencies]
pytest = "^8.3.1"
pytest-asyncio = "^0.23.8"
pytest-md-report = "^0.6.2"

[tool.isort]
profile = "black"
Expand Down

0 comments on commit 87b9aa4

Please sign in to comment.