[fix] workflow #28
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 ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python with uv | |
| uses: astral-sh/setup-uv@v2 | |
| with: | |
| uv-version: latest | |
| - name: Create virtual environment | |
| run: uv venv | |
| - name: Add venv to environment | |
| run: echo "$PWD/.venv/bin" >> $GITHUB_PATH | |
| - name: Install linters | |
| run: uv pip install black flake8 | |
| - name: Check code formatting with Black | |
| run: | | |
| echo "🔍 Checking code formats..." | |
| uv run black main.py meshbot/ scripts/ . | |
| - name: Lint with flake8 | |
| run: | | |
| uv run flake8 meshbot/ main.py scripts/ \ | |
| --max-line-length=88 \ | |
| --ignore=E203,W503,E501,F541 \ | |
| --exclude=__pycache__,*.egg-info,build,dist,.git,.venv,venv,env,site-packages | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python with uv | |
| uses: astral-sh/setup-uv@v2 | |
| with: | |
| uv-version: latest | |
| - name: Create virtual environment | |
| run: uv venv | |
| - name: Add venv to environment | |
| run: echo "$PWD/.venv/bin" >> $GITHUB_PATH | |
| - name: Install dependencies | |
| run: | | |
| uv pip install -r requirements.txt | |
| uv pip install pytest | |
| - name: Create minimal config file | |
| run: | | |
| cat > config.json << 'EOF' | |
| { | |
| "platform": "ollama", | |
| "api_keys": { | |
| "openai": "test-key", | |
| "deepseek": "test-key", | |
| "openrouter": "test-key", | |
| "gemini": "test-key", | |
| "claude": "test-key", | |
| "siliconflow": "test-key", | |
| "fastapi": "test-token" | |
| }, | |
| "model_settings": { | |
| "ollama": "qwen2.5:7b", | |
| "openai": "gpt-3.5-turbo", | |
| "deepseek": "deepseek-chat", | |
| "openrouter": "openai/gpt-3.5-turbo", | |
| "gemini": "gemini-pro", | |
| "claude": "claude-3-sonnet-20240229", | |
| "siliconflow": "deepseek-ai/DeepSeek-V2-Chat", | |
| "fastapi": "fastapi-default" | |
| }, | |
| "service_urls": { | |
| "websockets": "ws://localhost:9238", | |
| "fastapi": "http://127.0.0.1:8000" | |
| } | |
| } | |
| EOF | |
| echo "✅ Created minimal config.json" | |
| - name: Verify main module imports | |
| run: | | |
| uv run python -c "import main; print('✅ Main module imported successfully')" | |
| - name: Setup environment file | |
| run: | | |
| if [ ! -f .env ]; then | |
| cp .env.example .env | |
| echo "✅ Created .env from .env.example" | |
| else | |
| echo "ℹ️ .env already exists, skipping copy" | |
| fi | |
| - name: Run tests | |
| run: | | |
| uv run pytest -v --tb=short | |
| continue-on-error: true |