Files
aitbc/.gitea/workflows/python-tests.yml
aitbc 3f98f3f7bf
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Failing after 5s
CLI Tests / test-cli (push) Failing after 3m17s
Documentation Validation / validate-docs (push) Successful in 8s
Documentation Validation / validate-policies-strict (push) Failing after 3s
Integration Tests / test-service-integration (push) Failing after 1s
Package Tests / Python package - aitbc-agent-sdk (push) Successful in 30s
Package Tests / Python package - aitbc-core (push) Failing after 11s
Package Tests / Python package - aitbc-crypto (push) Failing after 11s
Package Tests / Python package - aitbc-sdk (push) Failing after 12s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 6s
Package Tests / JavaScript package - aitbc-token (push) Failing after 18s
Production Tests / Production Integration Tests (push) Failing after 11s
Python Tests / test-python (push) Failing after 2m54s
Security Scanning / security-scan (push) Failing after 48s
ci: add service host discovery and strict policy docs validation
- Add multi-candidate host discovery (localhost, host.docker.internal, gateway) in api-endpoint-tests
- Pass discovered service host via AITBC_API_HOST environment variable to test script
- Update test_api_endpoints.py to use AITBC_API_HOST for all service URLs
- Add validate-policies-strict job to docs-validation workflow for policy Markdown files
- Add job names to package-tests matrix for better CI output clarity
- Add --import
2026-04-18 12:28:19 +02:00

90 lines
2.8 KiB
YAML

name: Python Tests
on:
push:
branches: [main, develop]
paths:
- 'apps/**/*.py'
- 'packages/py/**'
- 'tests/**'
- 'pyproject.toml'
- 'requirements.txt'
- '.gitea/workflows/python-tests.yml'
pull_request:
branches: [main, develop]
workflow_dispatch:
concurrency:
group: python-tests-${{ github.ref }}
cancel-in-progress: true
jobs:
test-python:
runs-on: debian
timeout-minutes: 15
steps:
- name: Clone repository
run: |
WORKSPACE="/var/lib/aitbc-workspaces/python-tests"
rm -rf "$WORKSPACE"
mkdir -p "$WORKSPACE"
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Setup Python environment
run: |
cd /var/lib/aitbc-workspaces/python-tests/repo
# Ensure standard directories exist
mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc
python3 -m venv venv
source venv/bin/activate
pip install -q --upgrade pip setuptools wheel
pip install -q -r requirements.txt
pip install -q pytest pytest-asyncio pytest-cov pytest-mock pytest-timeout click pynacl locust
echo "✅ Python $(python3 --version) environment ready"
- name: Run linting
run: |
cd /var/lib/aitbc-workspaces/python-tests/repo
source venv/bin/activate
if command -v ruff >/dev/null 2>&1; then
ruff check apps/ packages/py/ --select E,F --ignore E501 -q || echo "⚠️ Ruff warnings"
fi
echo "✅ Linting completed"
- name: Run tests
run: |
cd /var/lib/aitbc-workspaces/python-tests/repo
source venv/bin/activate
# Install packages in development mode
pip install -e packages/py/aitbc-crypto/
pip install -e packages/py/aitbc-sdk/
export PYTHONPATH="apps/coordinator-api/src:apps/blockchain-node/src:apps/wallet/src:packages/py/aitbc-crypto/src:packages/py/aitbc-sdk/src:."
# Test if packages are importable
python3 -c "import aitbc_crypto; print('✅ aitbc_crypto imported')"
python3 -c "import aitbc_sdk; print('✅ aitbc_sdk imported')"
pytest tests/ \
apps/coordinator-api/tests/ \
apps/blockchain-node/tests/ \
apps/wallet/tests/ \
packages/py/aitbc-crypto/tests/ \
packages/py/aitbc-sdk/tests/ \
--tb=short -q --timeout=30 --import-mode=importlib \
--ignore=tests/production \
--ignore=apps/coordinator-api/tests/test_confidential*.py
echo "✅ Python tests completed"
- name: Cleanup
if: always()
run: rm -rf /var/lib/aitbc-workspaces/python-tests