Skip to content

fix configuration refresh (#490) #189

fix configuration refresh (#490)

fix configuration refresh (#490) #189

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: AIOS Application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Git Clone Action
# You may pin to the exact commit or the version.
# uses: sudosubin/git-clone-action@8a93ce24d47782e30077508cccacf8a05a891bae
uses: sudosubin/git-clone-action@v1.0.1
with:
# Repository owner and name. Ex: sudosubin/git-clone-action
repository: agiresearch/Cerebrum
path: Cerebrum
- name: Install cerebrum special edition
run: |
python -m pip install -e Cerebrum/
- name: Download and install Ollama
run: |
curl -fsSL https://ollama.com/install.sh | sh
- name: Pull Ollama models
run: |
ollama pull qwen2.5:7b
- name: Run Ollama serve
run: |
ollama serve 2>&1 | tee ollama-llm.log &
# Wait for ollama to start
for i in {1..30}; do
if curl -s http://localhost:11434/api/version > /dev/null; then
echo "Ollama is running"
break
fi
echo "Waiting for ollama to start... ($i/30)"
sleep 1
done
# Verify ollama is running
curl -s http://localhost:11434/api/version || (echo "Failed to start ollama" && exit 1)
- name: Run AIOS kernel in background
run: |
bash runtime/launch_kernel.sh &>logs &
KERNEL_PID=$!
# Set maximum wait time (60 seconds)
max_wait=60
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 logs
exit 1
fi
if nc -z localhost 8000; then
if curl -s http://localhost:8000/health > /dev/null; 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 logs
exit 1
fi
echo "Waiting for kernel to start... (${elapsed}s elapsed)"
sleep 1
done
- name: Run all tests
run: |
# Create test results directory
mkdir -p test_results
# Function to check if a path contains agent or llm
contains_agent_or_llm() {
local dir_path=$(dirname "$1")
if [[ "$dir_path" == *"agent"* || "$dir_path" == *"llm"* ]]; then
return 0 # True in bash
else
return 1 # False in bash
fi
}
# Process test files
find tests -type f -name "*.py" | while read -r test_file; do
if contains_agent_or_llm "$test_file"; then
# For agent or llm directories, only run ollama tests
if [[ "$test_file" == *"ollama"* ]]; then
echo "Running Ollama test in agent/llm directory: $test_file"
python $test_file | tee -a ollama_tests.log
echo "----------------------------------------"
fi
else
# For other directories, run all tests
echo "Running test: $test_file"
python $test_file | tee -a all_tests.log
echo "----------------------------------------"
fi
done
- name: Upload a Build Artifact
if: always() # Upload logs even if job fails
uses: actions/upload-artifact@v4.4.3
with:
name: logs
path: |
logs
agent.log
- name: Collect debug information
if: failure()
run: |
echo "=== Kernel Logs ==="
cat logs
echo "=== Environment Variables ==="
env | grep -i api_key || true
echo "=== Process Status ==="
ps aux | grep kernel