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

@@ -53,10 +53,9 @@ jobs:
- 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"
if venv/bin/python -m ruff --version >/dev/null 2>&1; then
venv/bin/python -m ruff check apps/ packages/py/ --select E,F --ignore E501 -q || echo "⚠️ Ruff warnings"
fi
echo "✅ Linting completed"
@@ -64,19 +63,18 @@ jobs:
- 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/
venv/bin/python -m pip install -e packages/py/aitbc-crypto/
venv/bin/python -m 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')"
venv/bin/python -c "import aitbc_crypto; print('✅ aitbc_crypto imported')"
venv/bin/python -c "import aitbc_sdk; print('✅ aitbc_sdk imported')"
pytest tests/archived_phase_tests/ \
venv/bin/python -m pytest tests/archived_phase_tests/ \
tests/cross_phase/ \
apps/wallet/tests/ \
packages/py/aitbc-crypto/tests/ \