Skip to content

Commit

Permalink
chore(ci/api): use pytest-github-actions-annotate-failures
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Mar 11, 2024
1 parent 1e13732 commit 238a6eb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
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

0 comments on commit 238a6eb

Please sign in to comment.