Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci/api): use pytest-github-actions-annotate-failures #275

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ jobs:
- name: Set UID
run: echo "UID=$(id --user)" > .env
- name: Lint the backend code
run: make api-lint
run: docker compose run --rm api sh -c "ruff format --check . ; ruff check ."

test:
name: "Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set UID
- name: Set env vars
run: echo "UID=$(id --user)" > .env
- name: Build the containers
run: docker compose up -d --build db api
- name: Check for missing migrations
run: docker compose exec -T api ./manage.py makemigrations --check --dry-run --no-input
- name: Run backend tests
run: make api-test
- name: Run tests
run: docker-compose run -e GITHUB_ACTIONS=true -e ENV=test -e PYTEST_RUN_PATH=/app api sh -c 'pip install pytest-github-actions-annotate-failures && pytest --no-cov-on-fail --cov -vvv -s'

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ api-sh: ## Shell into the API

.PHONY: api-lint
api-lint: ## Lint the backend
@docker compose run --rm api sh -c "ruff format --check . ; ruff . --show-source"
@docker compose run --rm api sh -c "ruff format --check . ; ruff check . --show-source"

.PHONY: api-lint-fix
api-lint-fix: ## Lint and fix the API
Expand Down
4 changes: 4 additions & 0 deletions api/outdated/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ def test_project_command(
stderr
== f"Projects with names {', '.join(nonexistant_projects)} do not exist\n"
)


def test_test_annotations_for_failures():
assert 0
2 changes: 1 addition & 1 deletion api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ ruff = "^0.3.0"
[tool.ruff]
line-length = 88
select = ["ALL"]
output-format = "github"

ignore = [
"A003", # flake8-builtins - Class attribute {name} is shadowing a Python builtin
Expand Down Expand Up @@ -91,7 +92,6 @@ ignore-fully-untyped = true
[tool.ruff.flake8-unused-arguments]
ignore-variadic-names = true


[tool.ruff.extend-per-file-ignores]
"factories.py" = [
"S311",
Expand Down
Loading