Files
aitbc/.gitea/workflows/package-tests.yml
aitbc b293059bd6
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
ci: add service lifecycle management and fix venv activation in workflows
- 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.
2026-04-19 21:19:53 +02:00

164 lines
4.9 KiB
YAML

name: Package Tests
on:
push:
branches: [main, develop]
paths:
- 'packages/**'
- 'pyproject.toml'
- '.gitea/workflows/package-tests.yml'
pull_request:
branches: [main, develop]
workflow_dispatch:
concurrency:
group: package-tests-${{ github.ref }}
cancel-in-progress: true
jobs:
test-python-packages:
name: Python package - ${{ matrix.package.name }}
runs-on: debian
timeout-minutes: 15
strategy:
matrix:
package:
- name: "aitbc-core"
path: "packages/py/aitbc-core"
- name: "aitbc-crypto"
path: "packages/py/aitbc-crypto"
- name: "aitbc-sdk"
path: "packages/py/aitbc-sdk"
- name: "aitbc-agent-sdk"
path: "packages/py/aitbc-agent-sdk"
steps:
- name: Clone repository
run: |
WORKSPACE="/var/lib/aitbc-workspaces/pkg-${{ matrix.package.name }}"
rm -rf "$WORKSPACE"
mkdir -p "$WORKSPACE"
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Setup and test package
run: |
WORKSPACE="/var/lib/aitbc-workspaces/pkg-${{ matrix.package.name }}"
cd "$WORKSPACE/repo/${{ matrix.package.path }}"
echo "=== Testing ${{ matrix.package.name }} ==="
echo "Directory: $(pwd)"
ls -la
# Ensure standard directories exist
mkdir -p /var/lib/aitbc/data /var/lib/aitbc/keystore /etc/aitbc /var/log/aitbc
bash "$WORKSPACE/repo/scripts/ci/setup-python-venv.sh" \
--repo-dir "$PWD" \
--venv-dir "$PWD/venv" \
--mode copy \
--extra-packages "pytest mypy black"
if [[ "${{ matrix.package.name }}" == "aitbc-sdk" ]]; then
venv/bin/pip install -q -e "$WORKSPACE/repo/packages/py/aitbc-crypto"
fi
# Install dependencies
if [[ -f "pyproject.toml" ]]; then
venv/bin/pip install -q -e ".[dev]" 2>/dev/null || venv/bin/pip install -q -e .
fi
if [[ -f "requirements.txt" ]]; then
venv/bin/pip install -q -r requirements.txt
fi
# Linting
echo "=== Linting ==="
if [[ -d "src" ]]; then
mypy src/ --ignore-missing-imports --no-error-summary 2>/dev/null || echo "⚠️ MyPy warnings"
black --check src/ 2>/dev/null || echo "⚠️ Black warnings"
fi
# Tests
echo "=== Tests ==="
if [[ -d "tests" ]]; then
pytest tests/ -q --tb=short
else
echo "⚠️ No tests directory found"
fi
echo "✅ ${{ matrix.package.name }} testing completed"
- name: Build package
run: |
WORKSPACE="/var/lib/aitbc-workspaces/pkg-${{ matrix.package.name }}"
cd "$WORKSPACE/repo/${{ matrix.package.path }}"
if [[ -f "pyproject.toml" ]]; then
bash "$WORKSPACE/repo/scripts/ci/setup-python-venv.sh" \
--repo-dir "$PWD" \
--venv-dir "$PWD/venv-build" \
--skip-requirements \
--extra-packages "build"
venv-build/bin/python -m build
echo "✅ Package built"
fi
- name: Cleanup
if: always()
run: rm -rf "/var/lib/aitbc-workspaces/pkg-${{ matrix.package.name }}"
test-javascript-packages:
name: JavaScript package - ${{ matrix.package.name }}
runs-on: debian
timeout-minutes: 15
strategy:
matrix:
package:
- name: "aitbc-sdk-js"
path: "packages/js/aitbc-sdk"
- name: "aitbc-token"
path: "packages/solidity/aitbc-token"
steps:
- name: Clone repository
run: |
WORKSPACE="/var/lib/aitbc-workspaces/jspkg-${{ matrix.package.name }}"
rm -rf "$WORKSPACE"
mkdir -p "$WORKSPACE"
cd "$WORKSPACE"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Setup and test package
run: |
WORKSPACE="/var/lib/aitbc-workspaces/jspkg-${{ matrix.package.name }}"
cd "$WORKSPACE/repo/${{ matrix.package.path }}"
echo "=== Testing ${{ matrix.package.name }} ==="
if [[ ! -f "package.json" ]]; then
echo "⚠️ No package.json found, skipping"
exit 0
fi
node --version
npm --version
npm install --legacy-peer-deps
# Build
npm run build
echo "✅ Build passed"
# Lint
npm run lint 2>/dev/null && echo "✅ Lint passed" || echo "⚠️ Lint skipped"
# Test
npm test
echo "✅ Tests passed"
echo "✅ ${{ matrix.package.name }} completed"
- name: Cleanup
if: always()
run: rm -rf "/var/lib/aitbc-workspaces/jspkg-${{ matrix.package.name }}"