/ .github / workflows / test-core.yml
test-core.yml
 1  name: Core Tests
 2  
 3  on:
 4    push:
 5      branches: [ main, develop ]
 6      paths:
 7        - 'src/**'
 8        - 'pyproject.toml'
 9        - '.github/workflows/test-core.yml'
10    pull_request:
11      branches: [ main, develop ]
12      paths:
13        - 'src/**'
14        - 'pyproject.toml'
15        - '.github/workflows/test-core.yml'
16    workflow_dispatch:
17  
18  jobs:
19    test-core:
20      runs-on: ubuntu-latest
21      timeout-minutes: 20
22  
23      steps:
24      - uses: actions/checkout@v4
25          with:
26            persist-credentials: false
27      - name: Set up Python 3.11
28        uses: actions/setup-python@v5
29        with:
30          python-version: '3.11'
31  
32      - name: Install UV
33        run: |
34          curl -LsSf https://astral.sh/uv/install.sh | sh
35          echo "$HOME/.local/bin" >> $GITHUB_PATH
36  
37      - name: Install dependencies
38        run: |
39          cd src/praisonai
40          uv pip install --system ."[ui,gradio,api,agentops,google,openai,anthropic,cohere,chat,code,realtime,call,crewai,autogen]"
41          uv pip install --system duckduckgo_search
42          uv pip install --system pytest pytest-asyncio pytest-cov pytest-timeout
43          uv pip install --system "praisonaiagents[knowledge]"
44  
45      - name: Set environment variables
46        run: |
47          echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY || 'sk-test-key-for-github-actions-testing-only-not-real' }}" >> $GITHUB_ENV
48          echo "OPENAI_API_BASE=${{ secrets.OPENAI_API_BASE || 'https://api.openai.com/v1' }}" >> $GITHUB_ENV
49          echo "OPENAI_MODEL_NAME=${{ secrets.OPENAI_MODEL_NAME || 'gpt-5-nano' }}" >> $GITHUB_ENV
50          echo "PYTHONPATH=${{ github.workspace }}/src/praisonai-agents:$PYTHONPATH" >> $GITHUB_ENV
51  
52      - name: Run Unit Tests
53        run: |
54          cd src/praisonai && python -m pytest tests/unit/ -v --tb=short --disable-warnings \
55            --cov=praisonai --cov-report=xml --cov-branch \
56            --timeout=60 || echo "Some unit tests failed"
57        continue-on-error: true
58  
59      - name: Run Integration Tests
60        run: |
61          cd src/praisonai && python -m pytest tests/integration/ -v --tb=short --disable-warnings \
62            --timeout=60 \
63            --ignore=tests/integration/test_tracker_complex_tasks.py \
64            --ignore=tests/integration/test_serve_integration.py \
65            || echo "Some integration tests failed"
66  
67      - name: Upload coverage to Codecov
68        if: always()
69        uses: codecov/codecov-action@v5
70        with:
71          token: ${{ secrets.CODECOV_TOKEN || '' }}
72          files: src/praisonai/coverage.xml
73          flags: core-tests
74          fail_ci_if_error: false