diff --git a/.github/workflows/backend.yaml b/.github/workflows/backend.yaml index 8adbf136..061e2161 100644 --- a/.github/workflows/backend.yaml +++ b/.github/workflows/backend.yaml @@ -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' + diff --git a/Makefile b/Makefile index c16cd338..90c2e21d 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/api/outdated/tests/test_commands.py b/api/outdated/tests/test_commands.py index 696d3b27..b2aa7fee 100644 --- a/api/outdated/tests/test_commands.py +++ b/api/outdated/tests/test_commands.py @@ -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 diff --git a/api/pyproject.toml b/api/pyproject.toml index b41e81b8..cab2056a 100644 --- a/api/pyproject.toml +++ b/api/pyproject.toml @@ -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 @@ -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",