CI Pipeline #224
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 Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| schedule: | |
| # Run tests daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| env: | |
| PYTHON_VERSION: "3.11" | |
| jobs: | |
| # Code Quality Checks | |
| quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: make install-dev | |
| - name: Check code formatting and linting | |
| run: make format-check lint | |
| # Testing | |
| test: | |
| name: Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.11"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: make install-dev | |
| - name: Run tests (fast) | |
| if: github.event_name == 'push' | |
| run: make test | |
| - name: Run tests with coverage | |
| if: github.event_name == 'pull_request' || github.event_name == 'schedule' | |
| run: make test-coverage | |
| - name: Upload coverage to Codecov | |
| if: github.event_name == 'pull_request' || github.event_name == 'schedule' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| file: docker/coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| - name: Upload coverage reports | |
| if: github.event_name == 'pull_request' || github.event_name == 'schedule' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-reports-${{ matrix.python-version }} | |
| path: docker/htmlcov/ | |
| # Security Scan (only on PRs and scheduled runs) | |
| security: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || github.event_name == 'schedule' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: make install-dev | |
| - name: Run security checks | |
| run: make security-check | |
| - name: Upload security reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: security-reports | |
| path: | | |
| safety-report.json | |
| bandit-security.json | |
| # Dependency Check (only on PRs and scheduled runs) | |
| dependencies: | |
| name: Dependency Check | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || github.event_name == 'schedule' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: make install-dev | |
| - name: Run dependency audit | |
| run: make audit | |
| - name: Upload audit report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: dependency-audit | |
| path: audit-report.json | |
| # Performance Tests (optional) | |
| performance: | |
| name: Performance Tests | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: make install-dev | |
| - name: Run performance tests | |
| run: | | |
| # Add performance test commands here | |
| echo "Performance tests would run here" |