Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Adding workflows for automated testing for pull requests #380

Merged
merged 5 commits into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 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
with:
ref: main # Specify main branch

- 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: Run AIOS kernel in background
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
# Set environment variable when starting kernel
export GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}
bash runtime/launch_kernel.sh &>logs &
sleep 10 # Wait for kernel to start

# Check if kernel is running
if curl -s http://localhost:8000/health > /dev/null; then
echo "Kernel started successfully"
else
echo "Error: Kernel failed to start"
exit 1
fi

- name: Run the run-agent code
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
# Verify if API key is set
if [ -z "$GEMINI_API_KEY" ]; then
echo "Error: GEMINI_API_KEY is not set in GitHub Secrets"
exit 1
fi
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

- 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