|
| 1 | +name: Phase 2 Release Gate |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - dev |
| 8 | + - 'release/**' |
| 9 | + paths: |
| 10 | + # Trigger on Phase 2 critical files |
| 11 | + - 'pipeline/**/*.py' |
| 12 | + - 'sanitizer.py' |
| 13 | + - 'outbound.py' |
| 14 | + - 'config.py' |
| 15 | + - '__init__.py' |
| 16 | + - 'tests/test_plugins_security.py' |
| 17 | + - 'tests/test_metadata_contract.py' |
| 18 | + - 'tests/test_pipeline_dependency_policy.py' |
| 19 | + - 'tests/test_outbound_payload_safety.py' |
| 20 | + - 'web/**/*.js' |
| 21 | + - 'tests/e2e/**/*.js' |
| 22 | + - '.github/workflows/phase2-release-gate.yml' |
| 23 | + pull_request: |
| 24 | + branches: |
| 25 | + - main |
| 26 | + - dev |
| 27 | + paths: |
| 28 | + - 'pipeline/**/*.py' |
| 29 | + - 'sanitizer.py' |
| 30 | + - 'outbound.py' |
| 31 | + - 'config.py' |
| 32 | + - '__init__.py' |
| 33 | + - 'tests/test_plugins_security.py' |
| 34 | + - 'tests/test_metadata_contract.py' |
| 35 | + - 'tests/test_pipeline_dependency_policy.py' |
| 36 | + - 'tests/test_outbound_payload_safety.py' |
| 37 | + - 'web/**/*.js' |
| 38 | + - 'tests/e2e/**/*.js' |
| 39 | + - '.github/workflows/phase2-release-gate.yml' |
| 40 | + workflow_dispatch: |
| 41 | + |
| 42 | +jobs: |
| 43 | + phase2-python-gate: |
| 44 | + name: Phase 2 Python Security & Contract Tests |
| 45 | + runs-on: ubuntu-latest |
| 46 | + timeout-minutes: 5 |
| 47 | + |
| 48 | + steps: |
| 49 | + - name: Checkout code |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Set up Python 3.10 |
| 53 | + uses: actions/setup-python@v5 |
| 54 | + with: |
| 55 | + python-version: '3.10' |
| 56 | + cache: 'pip' |
| 57 | + cache-dependency-path: | |
| 58 | + pyproject.toml |
| 59 | + pytest.ini |
| 60 | +
|
| 61 | + - name: Install dependencies |
| 62 | + run: | |
| 63 | + pip install pytest jsonschema |
| 64 | +
|
| 65 | + - name: Run Plugin Security Suite |
| 66 | + run: | |
| 67 | + pytest -q tests/test_plugins_security.py --tb=short |
| 68 | + timeout-minutes: 2 |
| 69 | + |
| 70 | + - name: Run Metadata Contract Suite |
| 71 | + run: | |
| 72 | + pytest -q tests/test_metadata_contract.py --tb=short |
| 73 | + timeout-minutes: 1 |
| 74 | + |
| 75 | + - name: Run Dependency Policy Suite |
| 76 | + run: | |
| 77 | + pytest -q tests/test_pipeline_dependency_policy.py --tb=short |
| 78 | + timeout-minutes: 1 |
| 79 | + |
| 80 | + - name: Run Outbound Payload Safety Suite |
| 81 | + run: | |
| 82 | + pytest -q tests/test_outbound_payload_safety.py --tb=short |
| 83 | + timeout-minutes: 1 |
| 84 | + |
| 85 | + - name: Summary |
| 86 | + if: success() |
| 87 | + run: | |
| 88 | + echo "✅ Phase 2 Python Gate Passed" |
| 89 | + echo "- Plugin security: PASS" |
| 90 | + echo "- Metadata contract: PASS" |
| 91 | + echo "- Dependency policy: PASS" |
| 92 | + echo "- Outbound payload safety: PASS" |
| 93 | +
|
| 94 | + phase2-e2e-gate: |
| 95 | + name: Phase 2 E2E Regression Tests |
| 96 | + runs-on: ubuntu-latest |
| 97 | + timeout-minutes: 10 |
| 98 | + |
| 99 | + steps: |
| 100 | + - name: Checkout code |
| 101 | + uses: actions/checkout@v4 |
| 102 | + |
| 103 | + - name: Set up Node.js 18 |
| 104 | + uses: actions/setup-node@v4 |
| 105 | + with: |
| 106 | + node-version: '18' |
| 107 | + cache: 'npm' |
| 108 | + |
| 109 | + - name: Set up Python 3.10 (for HTTP server) |
| 110 | + uses: actions/setup-python@v5 |
| 111 | + with: |
| 112 | + python-version: '3.10' |
| 113 | + |
| 114 | + - name: Install npm dependencies |
| 115 | + run: npm ci |
| 116 | + |
| 117 | + - name: Install Playwright browsers |
| 118 | + run: npx playwright install chromium --with-deps |
| 119 | + |
| 120 | + - name: Run E2E tests |
| 121 | + run: npm test |
| 122 | + env: |
| 123 | + CI: true |
| 124 | + timeout-minutes: 8 |
| 125 | + |
| 126 | + - name: Upload test results |
| 127 | + if: failure() |
| 128 | + uses: actions/upload-artifact@v4 |
| 129 | + with: |
| 130 | + name: playwright-report |
| 131 | + path: playwright-report/ |
| 132 | + retention-days: 7 |
| 133 | + |
| 134 | + - name: Upload screenshots on failure |
| 135 | + if: failure() |
| 136 | + uses: actions/upload-artifact@v4 |
| 137 | + with: |
| 138 | + name: playwright-screenshots |
| 139 | + path: test-results/ |
| 140 | + retention-days: 7 |
| 141 | + |
| 142 | + - name: Summary |
| 143 | + if: success() |
| 144 | + run: | |
| 145 | + echo "✅ Phase 2 E2E Gate Passed" |
| 146 | + echo "- Preact loader: PASS" |
| 147 | + echo "- Settings UI: PASS" |
| 148 | + echo "- Statistics UI: PASS" |
| 149 | + echo "- Sidebar UI: PASS" |
| 150 | +
|
| 151 | + phase2-gate-complete: |
| 152 | + name: Phase 2 Gate Complete |
| 153 | + runs-on: ubuntu-latest |
| 154 | + needs: [phase2-python-gate, phase2-e2e-gate] |
| 155 | + if: always() |
| 156 | + |
| 157 | + steps: |
| 158 | + - name: Check gate status |
| 159 | + run: | |
| 160 | + if [[ "${{ needs.phase2-python-gate.result }}" == "success" ]] && [[ "${{ needs.phase2-e2e-gate.result }}" == "success" ]]; then |
| 161 | + echo "✅ Phase 2 Release Gate: ALL CHECKS PASSED" |
| 162 | + echo "" |
| 163 | + echo "Security & Governance:" |
| 164 | + echo " ✅ Plugin security (10 tests)" |
| 165 | + echo " ✅ Metadata contract (1 test)" |
| 166 | + echo " ✅ Dependency policy (2 tests)" |
| 167 | + echo " ✅ Outbound payload safety (4 tests)" |
| 168 | + echo "" |
| 169 | + echo "Frontend Regression:" |
| 170 | + echo " ✅ E2E tests (61 tests)" |
| 171 | + echo "" |
| 172 | + echo "This change is safe to merge." |
| 173 | + exit 0 |
| 174 | + else |
| 175 | + echo "❌ Phase 2 Release Gate: FAILED" |
| 176 | + echo "" |
| 177 | + echo "Python Gate: ${{ needs.phase2-python-gate.result }}" |
| 178 | + echo "E2E Gate: ${{ needs.phase2-e2e-gate.result }}" |
| 179 | + echo "" |
| 180 | + echo "Please fix the failing checks before merging." |
| 181 | + exit 1 |
| 182 | + fi |
0 commit comments