Fix: stabilize MCP client imports and unify test environment for CI &… #5
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: Python CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| PYTHONPATH: . | |
| MCP_SERVER_URL: wss://mcp.openai.com/v1 | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m venv venv | |
| if [ "${{ runner.os }}" == "Windows" ]; then | |
| .\venv\Scripts\python.exe -m pip install -r requirements.txt | |
| .\venv\Scripts\python.exe -m playwright install | |
| else | |
| ./venv/bin/python -m pip install -r requirements.txt | |
| ./venv/bin/python -m playwright install | |
| fi | |
| - name: Run tests | |
| run: | | |
| if [ "${{ runner.os }}" == "Windows" ]; then | |
| .\venv\Scripts\Activate.ps1 | |
| pytest -v --maxfail=1 --disable-warnings --html=report.html --self-contained-html | |
| else | |
| source venv/bin/activate | |
| pytest -v --maxfail=1 --disable-warnings --html=report.html --self-contained-html | |
| fi | |
| - name: Upload HTML Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pytest-report | |
| path: report.html |