-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackend-test.sh
More file actions
executable file
·44 lines (40 loc) · 1.59 KB
/
Copy pathbackend-test.sh
File metadata and controls
executable file
·44 lines (40 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
###############################################################################
# backend-test.sh — Backend lint and full test suite
#
# Runs four sequential checks against the backend Python package:
# 1. ruff check PEP 8 / import / style linting
# 2. ruff format --check formatting diff (non-destructive, fails if dirty)
# 3. pytest unit fast unit tests (no DB) with coverage report
# 4. pytest integration database-backed integration tests with coverage
#
# JUnit XML results are written to:
# backend/test-results-unit.xml
# backend/test-results-integration.xml
# These are picked up by the publish-test-results composite action.
#
# Usage:
# cd backend && bash ../.github/scripts/backend-test.sh
#
# Expected CWD: backend/
# Dependencies: poetry (installs ruff, pytest, pytest-cov)
# Caller(s): ci.yml — backend-ci job / make lint / make test
###############################################################################
set -euo pipefail
echo "::group::Ruff lint"
poetry run ruff check app/ --output-format=github
poetry run ruff format app/ --check
echo "::endgroup::"
echo "::group::Unit tests"
poetry run pytest tests/unit -m unit -v \
--cov=app --cov-report=xml --cov-report=html \
--junitxml=test-results-unit.xml \
--maxfail=5 --tb=short
echo "::endgroup::"
echo "::group::Integration tests"
poetry run pytest tests/integration -m integration -v \
--cov=app --cov-report=xml --cov-report=html \
--junitxml=test-results-integration.xml \
--maxfail=5 --tb=short
echo "::endgroup::"
echo "✅ Backend tests passed"