ci: add service lifecycle management and fix venv activation in workflows
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 8s
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 3s
Package Tests / Python package - aitbc-core (push) Failing after 3s
Package Tests / Python package - aitbc-crypto (push) Failing after 2s
Package Tests / Python package - aitbc-sdk (push) Failing after 2s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 3m31s
Package Tests / JavaScript package - aitbc-token (push) Failing after 8s
Production Tests / Production Integration Tests (push) Failing after 35s
Python Tests / test-python (push) Failing after 1m17s

- Added explicit service start/stop steps in api-endpoint-tests.yml
  - Start coordinator-api, exchange-api, wallet, and blockchain-rpc services before tests
  - Stop all started services in cleanup step
- Fixed venv activation in package-tests.yml
  - Changed from `source venv/bin/activate` to direct venv/bin/pip and venv/bin/python calls
  - Applied same pattern to venv-build for package building
- Fixed venv activation in production-tests.
This commit is contained in:
aitbc
2026-04-19 21:19:53 +02:00
parent a2f84648ab
commit b293059bd6
4 changed files with 46 additions and 17 deletions

View File

@@ -43,6 +43,27 @@ jobs:
# Ensure standard directories exist # Ensure standard directories exist
mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc
- name: Start required services
run: |
echo "Starting AITBC services for endpoint testing..."
# Start coordinator-api
systemctl start aitbc-coordinator-api.service || echo "⚠️ coordinator-api already running or failed to start"
# Start exchange-api
systemctl start aitbc-exchange-api.service || echo "⚠️ exchange-api already running or failed to start"
# Start wallet daemon
systemctl start aitbc-wallet.service || echo "⚠️ wallet already running or failed to start"
# Start blockchain RPC
systemctl start aitbc-blockchain-rpc.service || echo "⚠️ blockchain-rpc already running or failed to start"
# Give services time to initialize
sleep 5
echo "✅ Services started"
- name: Wait for services - name: Wait for services
id: wait-services id: wait-services
continue-on-error: true continue-on-error: true
@@ -124,4 +145,12 @@ jobs:
- name: Cleanup - name: Cleanup
if: always() if: always()
run: rm -rf /var/lib/aitbc-workspaces/api-tests run: |
# Stop the services we started
systemctl stop aitbc-coordinator-api.service || true
systemctl stop aitbc-exchange-api.service || true
systemctl stop aitbc-wallet.service || true
systemctl stop aitbc-blockchain-rpc.service || true
# Clean up workspace
rm -rf /var/lib/aitbc-workspaces/api-tests

View File

@@ -58,18 +58,17 @@ jobs:
--venv-dir "$PWD/venv" \ --venv-dir "$PWD/venv" \
--mode copy \ --mode copy \
--extra-packages "pytest mypy black" --extra-packages "pytest mypy black"
source venv/bin/activate
if [[ "${{ matrix.package.name }}" == "aitbc-sdk" ]]; then if [[ "${{ matrix.package.name }}" == "aitbc-sdk" ]]; then
pip install -q -e "$WORKSPACE/repo/packages/py/aitbc-crypto" venv/bin/pip install -q -e "$WORKSPACE/repo/packages/py/aitbc-crypto"
fi fi
# Install dependencies # Install dependencies
if [[ -f "pyproject.toml" ]]; then if [[ -f "pyproject.toml" ]]; then
pip install -q -e ".[dev]" 2>/dev/null || pip install -q -e . venv/bin/pip install -q -e ".[dev]" 2>/dev/null || venv/bin/pip install -q -e .
fi fi
if [[ -f "requirements.txt" ]]; then if [[ -f "requirements.txt" ]]; then
pip install -q -r requirements.txt venv/bin/pip install -q -r requirements.txt
fi fi
# Linting # Linting
@@ -100,8 +99,7 @@ jobs:
--venv-dir "$PWD/venv-build" \ --venv-dir "$PWD/venv-build" \
--skip-requirements \ --skip-requirements \
--extra-packages "build" --extra-packages "build"
source venv-build/bin/activate venv-build/bin/python -m build
python -m build
echo "✅ Package built" echo "✅ Package built"
fi fi

View File

@@ -37,7 +37,10 @@ jobs:
--repo-dir "$PWD" \ --repo-dir "$PWD" \
--venv-dir "$PWD/venv" \ --venv-dir "$PWD/venv" \
--skip-requirements \ --skip-requirements \
--extra-packages "pytest pytest-asyncio pytest-timeout requests pyjwt fastapi uvicorn[standard] redis bcrypt websockets numpy psutil prometheus-client" --extra-packages "pytest pytest-asyncio pytest-timeout requests pyjwt fastapi uvicorn[standard] redis bcrypt websockets numpy psutil prometheus-client celery aiohttp pydantic"
# Install agent-coordinator package with its dependencies
venv/bin/pip install -q -e apps/agent-coordinator
# Ensure standard directories exist # Ensure standard directories exist
mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc
@@ -62,11 +65,10 @@ jobs:
- name: Start agent coordinator - name: Start agent coordinator
run: | run: |
cd /var/lib/aitbc-workspaces/production-tests/repo cd /var/lib/aitbc-workspaces/production-tests/repo
source venv/bin/activate
export PYTHONPATH="apps/agent-coordinator/src:$PYTHONPATH" export PYTHONPATH="apps/agent-coordinator/src:$PYTHONPATH"
# Start agent coordinator in background # Start agent coordinator in background
nohup uvicorn app.main:app \ nohup venv/bin/uvicorn app.main:app \
--host 0.0.0.0 \ --host 0.0.0.0 \
--port 9001 \ --port 9001 \
--log-level info \ --log-level info \
@@ -93,10 +95,9 @@ jobs:
- name: Run production tests - name: Run production tests
run: | run: |
cd /var/lib/aitbc-workspaces/production-tests/repo cd /var/lib/aitbc-workspaces/production-tests/repo
source venv/bin/activate
export PYTHONPATH="apps/agent-coordinator/src:$PYTHONPATH" export PYTHONPATH="apps/agent-coordinator/src:$PYTHONPATH"
pytest tests/production/ \ venv/bin/pytest tests/production/ \
-v \ -v \
--tb=short \ --tb=short \
--timeout=30 \ --timeout=30 \

View File

@@ -6,6 +6,7 @@
# - Added bech32>=1.2.0 for blockchain address encoding (2026-03-30) # - Added bech32>=1.2.0 for blockchain address encoding (2026-03-30)
# - Fixed duplicate web3 entries and tenseal version # - Fixed duplicate web3 entries and tenseal version
# - All dependencies tested and working with current services # - All dependencies tested and working with current services
# - Cache invalidation for CLI rich dependency (2026-04-19)
# Core Web Framework # Core Web Framework
fastapi>=0.115.6 fastapi>=0.115.6