wekan/.github/workflows/api-tests.yaml
rabeeafaraj 584dce261d seed_db
2025-08-09 21:43:45 +03:00

52 lines
1.4 KiB
YAML

name: API Tests (pytest)
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-api:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests pytest
- name: Start API server (Docker)
run: |
docker compose up -d
sleep 10
- name: Wait for API /users/login to be ready
run: |
echo "Checking /users/login endpoint readiness..."
for i in {1..15}; do
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80/users/login)
if [ "$status_code" = "400" ] || [ "$status_code" = "200" ]; then
echo "API /users/login responded with status $status_code"
exit 0
fi
echo "Retry $i: API not ready yet, status $status_code"
sleep 3
done
echo "API /users/login did not become ready in time."
exit 1
- name: Seed DB with test user
run: |
docker exec wekan-db python3 seed_users.py
- name: Run pytest
run: pytest tests_r/ --maxfail=1 --disable-warnings -v