Spaces:
Sleeping
Sleeping
| # AI Agency Pro - Continuous Integration Workflow | |
| # This workflow runs tests, linting, and quality checks on every push and PR | |
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.9', '3.10', '3.11'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov flake8 black isort | |
| - name: Run linting with flake8 | |
| run: | | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Check code formatting with black | |
| run: | | |
| black --check --diff . | |
| continue-on-error: true | |
| - name: Check import sorting with isort | |
| run: | | |
| isort --check-only --diff . | |
| continue-on-error: true | |
| - name: Run unit tests with pytest | |
| run: | | |
| pytest tests/ -v -m unit --cov=. --cov-report=xml --cov-report=term-missing | |
| continue-on-error: true | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| continue-on-error: true | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install security tools | |
| run: | | |
| pip install bandit safety | |
| - name: Run security check with bandit | |
| run: | | |
| bandit -r . -ll -ii | |
| continue-on-error: true | |
| - name: Check dependencies for vulnerabilities | |
| run: | | |
| pip install -r requirements.txt | |
| safety check | |
| continue-on-error: true | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| - name: Verify app can be imported | |
| run: | | |
| python -c "import app; print('App imported successfully')" |