Skip to content

Merge pull request #15 from evison/main #3

Merge pull request #15 from evison/main

Merge pull request #15 from evison/main #3

name: Cerebrum-AIOS Integration Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
# Clone AIOS
- name: Git Clone AIOS
uses: actions/checkout@v4
with:
repository: agiresearch/AIOS
path: aios_root
ref: main
# Verify AIOS clone
- name: Verify AIOS clone
run: |
echo "=== AIOS root directory contents ==="
ls -la aios_root/
echo "=== Looking for setup files ==="
find aios_root/ -name "setup.py" -o -name "pyproject.toml"
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
# Install AIOS dependencies
- name: Install AIOS dependencies
working-directory: aios_root
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# Clone Cerebrum into AIOS directory
- name: Checkout Cerebrum
uses: actions/checkout@v4
with:
path: aios_root/Cerebrum
ref: ${{ github.ref }}
# Install Cerebrum
- name: Install Cerebrum
run: |
python -m pip install -e aios_root/Cerebrum/
# Run AIOS kernel
- name: Run AIOS kernel in background
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
cd aios_root
bash runtime/launch_kernel.sh &>../kernel.log &
KERNEL_PID=$!
cd ..
# Set maximum wait time (10 seconds)
max_wait=10
start_time=$SECONDS
# Dynamically check if the process is running until it succeeds or times out
while true; do
if ! ps -p $KERNEL_PID > /dev/null; then
echo "Kernel process died. Checking logs:"
cat kernel.log
exit 1
fi
if nc -z localhost 8000; then
if curl -s http://localhost:8000/health; then
echo "Kernel successfully started and healthy"
break
fi
fi
# Check if timed out
elapsed=$((SECONDS - start_time))
if [ $elapsed -ge $max_wait ]; then
echo "Timeout after ${max_wait} seconds. Kernel failed to start properly."
cat kernel.log
exit 1
fi
echo "Waiting for kernel to start... (${elapsed}s elapsed)"
sleep 1
done
# Run integration test
- name: Run integration test
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
# Debug information
echo "Checking kernel status..."
curl -v http://localhost:8000/health || true
echo "Network status:"
netstat -tlpn | grep 8000 || true
# Run the test
run-agent \
--llm_name gemini-1.5-flash \
--llm_backend google \
--agent_name_or_path demo_author/demo_agent \
--task "Tell me what is core idea of AIOS" \
--aios_kernel_url http://localhost:8000 \
2>&1 | tee agent.log
# Upload logs
- name: Upload logs
if: always()
uses: actions/[email protected]
with:
name: test-logs
path: |
kernel.log
agent.log
# Debug information
- name: Debug information
if: failure()
run: |
echo "=== Kernel log ==="
cat kernel.log
echo "=== Environment variables ==="
env | grep -i api_key || true
echo "=== Process status ==="
ps aux | grep kernel
echo "=== Directory structure ==="
tree aios_main || true