Skip to content

Commit

Permalink
Show pytest/ruff errors in actions output system
Browse files Browse the repository at this point in the history
The GitHub Actions CI/CD can show errors in pull request per line. This
is much better than reading stdout/stderr outputs. This patch adds a
pytest plugin that can generate gh actions reports, and opts Ruff into
github actions output when ran on CI.
  • Loading branch information
ikalnytskyi committed May 7, 2024
1 parent efb22c3 commit 84285a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:

- name: Run ruff
run: pipx run tox -e lint
env:
RUFF_OUTPUT_FORMAT: github

test:
strategy:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ optional = true
[tool.poetry.group.test.dependencies]
pytest = "^7.1"
responses = "^0.20"
pytest-github-actions-annotate-failures = "*"

[tool.poetry.plugins."httpie.plugins.auth.v1"]
credential-store = "httpie_credential_store:CredentialStoreAuthPlugin"
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ skip_install = true
[testenv:test]
commands_pre = poetry install --with test
commands = poetry run pytest -vv {posargs:.}
passenv = GITHUB_ACTIONS

[testenv:lint]
commands_pre = poetry install --only lint
commands =
ruff check {posargs:.}
ruff format --check --diff {posargs:.}
passenv = RUFF_OUTPUT_FORMAT

0 comments on commit 84285a7

Please sign in to comment.