Merge pull request #1 from towseef41/test #3
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
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov | |
| ############################################################### | |
| # IMPORTANT FIX — Add project root to PYTHONPATH | |
| # This resolves: ModuleNotFoundError: No module named 'app' | |
| ############################################################### | |
| - name: Add project root to PYTHONPATH | |
| run: | | |
| echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV | |
| ############################################################### | |
| # Avoid calling OpenAI API during CI | |
| ############################################################### | |
| - name: Set fake OpenAI API key for tests | |
| run: | | |
| echo "OPENAI_API_KEY=dummy-key" >> $GITHUB_ENV | |
| ############################################################### | |
| # Run Tests | |
| ############################################################### | |
| - name: Run Pytest with coverage | |
| run: | | |
| pytest --maxfail=1 --disable-warnings -q |