fix duplicate github action after merging #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .github/workflows/test-ollama.yml | |
| name: Test Ollama | |
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| push: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| actions: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| OLLAMA_MAX_WAIT: 60 | |
| KERNEL_MAX_WAIT: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install uv | |
| run: python -m pip install uv | |
| - name: Install dependencies | |
| run: | | |
| if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi | |
| - name: Clone Cerebrum | |
| uses: sudosubin/git-clone-action@v1.0.1 | |
| with: | |
| repository: agiresearch/Cerebrum | |
| path: Cerebrum | |
| - name: Install Cerebrum (editable) | |
| run: python -m uv pip install -e Cerebrum/ | |
| - name: Run AIOS kernel in background | |
| run: | | |
| bash runtime/launch_kernel.sh &>./kernel.log & | |
| KERNEL_PID=$! | |
| # Set maximum wait time (60 seconds) | |
| 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/status; then | |
| echo "Kernel successfully started" | |
| break | |
| fi | |
| fi | |
| # Check if timed out | |
| elapsed=$((SECONDS - start_time)) | |
| if [ $elapsed -ge $KERNEL_MAX_WAIT ]; then | |
| echo "Timeout after ${KERNEL_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 | |
| - name: Install Ollama | |
| run: curl -fsSL https://ollama.com/install.sh | sh | |
| - name: Pull Ollama model | |
| run: ollama pull qwen2.5:7b | |
| - name: Start Ollama | |
| run: | | |
| ollama serve > ollama-llm.log 2>&1 & | |
| for ((i=1;i<=${OLLAMA_MAX_WAIT};i++)); do | |
| curl -s http://localhost:11434/api/version && echo "Ollama ready" && break | |
| echo "Waiting for Ollama… ($i/${OLLAMA_MAX_WAIT})"; sleep 1 | |
| done | |
| curl -s http://localhost:11434/api/version > /dev/null \ | |
| || { echo "❌ Ollama failed to start"; exit 1; } | |
| - name: Run tests | |
| run: | | |
| mkdir -p test_results | |
| mapfile -t TESTS < <(find . -type f -path "*/llm/ollama/*" -name "*.py") | |
| if [ "${#TESTS[@]}" -eq 0 ]; then | |
| echo "⚠️ No llm/ollama tests found – skipping." | |
| exit 0 | |
| fi | |
| for t in "${TESTS[@]}"; do | |
| echo "▶️ Running $t" | |
| python "$t" | tee -a test_results/ollama_tests.log | |
| echo "----------------------------------------" | |
| done | |
| - name: Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: logs | |
| path: | | |
| ollama-llm.log | |
| kernel.log | |
| test_results/ |