ci: standardize Python execution across workflows and improve venv caching robustness
Some checks failed
CLI Tests / test-cli (push) Successful in 14s
Package Tests / Python package - aitbc-agent-sdk (push) Successful in 32s
Package Tests / Python package - aitbc-core (push) Successful in 23s
Package Tests / Python package - aitbc-crypto (push) Successful in 9s
Package Tests / Python package - aitbc-sdk (push) Successful in 13s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 7s
Package Tests / JavaScript package - aitbc-token (push) Successful in 12s
Python Tests / test-python (push) Successful in 18s
Staking Tests / test-staking-service (push) Failing after 9s
Staking Tests / test-staking-integration (push) Has been skipped
Staking Tests / test-staking-contract (push) Has been skipped
Staking Tests / run-staking-test-runner (push) Has been skipped

- Changed all Python/pip commands to use `venv/bin/python -m` pattern instead of direct tool invocation or source activation
  - package-tests.yml: pip, mypy, black, pytest now use `venv/bin/python -m`
  - python-tests.yml: ruff, pip, pytest now use `venv/bin/python -m` or `venv/bin/pytest`
  - staking-tests.yml: pytest now uses `venv/bin/pytest` instead of `python3 -m pytest`
- Added missing dependencies to workflow
This commit is contained in:
aitbc
2026-04-20 10:50:16 +02:00
parent 75d0588e29
commit fc803d80d0
5 changed files with 65 additions and 40 deletions

View File

@@ -43,26 +43,24 @@ jobs:
--repo-dir "$PWD" \
--venv-dir "$PWD/venv" \
--skip-requirements \
--extra-packages "pytest pytest-asyncio"
--extra-packages "pytest pytest-asyncio sqlmodel"
echo "✅ Python environment ready"
- name: Run staking service tests
run: |
cd /var/lib/aitbc-workspaces/staking-tests/repo
source venv/bin/activate
export PYTHONPATH="apps/coordinator-api/src:."
echo "🧪 Running staking service tests..."
python3 -m pytest tests/services/test_staking_service.py -v --tb=short
venv/bin/pytest tests/services/test_staking_service.py -v --tb=short
echo "✅ Service tests completed"
- name: Generate test data
run: |
cd /var/lib/aitbc-workspaces/staking-tests/repo
source venv/bin/activate
echo "🔧 Generating test data..."
python3 scripts/testing/generate_staking_test_data.py
venv/bin/python scripts/testing/generate_staking_test_data.py
echo "✅ Test data generated"
- name: Cleanup
@@ -86,20 +84,22 @@ jobs:
- name: Setup Python environment
run: |
cd /var/lib/aitbc-workspaces/staking-integration/repo
rm -rf venv
bash scripts/ci/setup-python-venv.sh \
--repo-dir "$PWD" \
--venv-dir "$PWD/venv"
--venv-dir "$PWD/venv" \
--skip-requirements \
--extra-packages "pytest pytest-asyncio sqlmodel"
echo "✅ Python environment ready"
- name: Run staking integration tests
run: |
cd /var/lib/aitbc-workspaces/staking-integration/repo
source venv/bin/activate
export PYTHONPATH="apps/coordinator-api/src:."
echo "🧪 Running staking integration tests..."
python3 -m pytest tests/integration/test_staking_lifecycle.py -v --tb=short
venv/bin/pytest tests/integration/test_staking_lifecycle.py -v --tb=short
echo "✅ Integration tests completed"
- name: Cleanup
@@ -157,6 +157,7 @@ jobs:
- name: Setup Python environment
run: |
cd /var/lib/aitbc-workspaces/staking-runner/repo
rm -rf venv
bash scripts/ci/setup-python-venv.sh \
--repo-dir "$PWD" \