Update CI to test only Python 3.10 and 3.11 #6
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/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: Test Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| # UPDATED: Only testing modern Python versions | |
| python-version: ['3.10', '3.11'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov black flake8 | |
| - name: Lint with flake8 | |
| run: | | |
| # Stop the build if there are Python syntax errors or undefined names | |
| flake8 src/ app/ scripts/ --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 src/ app/ scripts/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Check formatting with black | |
| run: | | |
| black --check src/ app/ scripts/ | |
| - name: Run tests with pytest | |
| run: | | |
| pytest tests/ -v --cov=src --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| fail_ci_if_error: false | |
| build: | |
| name: Build & Generate Reports | |
| runs-on: ubuntu-latest | |
| needs: test | |
| # Only run build on python 3.11 success to save resources | |
| if: success() | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run analysis pipeline | |
| run: | | |
| # Create output directories if they don't exist (just in case) | |
| mkdir -p outputs/reports outputs/dashboards outputs/figures | |
| # Run the master script | |
| python scripts/run_full_analysis.py | |
| - name: Validate reports | |
| run: | | |
| python -c " | |
| from pathlib import Path | |
| # Check all reports exist | |
| reports = [ | |
| 'outputs/reports/competitive_analysis_summary.txt', | |
| 'outputs/reports/market_sizing_report.txt', | |
| 'outputs/reports/pricing_strategy_recommendation.txt', | |
| 'outputs/reports/gtm_strategy_report.txt', | |
| 'outputs/reports/financial_model_report.txt' | |
| ] | |
| for r in reports: | |
| assert Path(r).exists(), f'Missing report: {r}' | |
| assert Path(r).stat().st_size > 1000, f'Report too small: {r}' | |
| print('✅ All reports validated') | |
| " | |
| - name: Archive reports | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: gtm-reports | |
| path: outputs/reports/ | |
| retention-days: 30 | |
| - name: Archive dashboards | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: gtm-dashboards | |
| path: outputs/dashboards/ | |
| retention-days: 30 | |
| deploy-docs: | |
| name: Deploy documentation | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # This is a placeholder for actual deployment steps | |
| # For now, it just echoes success to verify the pipeline flow | |
| - name: Deploy to GitHub Pages (Placeholder) | |
| run: echo "Documentation deployment step would go here" |