Files

277 lines
7.9 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Focused Regression Gate
on:
push:
branches:
- main
- dev
- 'release/**'
paths:
# Trigger on focused gate critical files
- 'pipeline/**/*.py'
- 'sanitizer.py'
- 'outbound.py'
- 'config.py'
- '__init__.py'
- 'tests/test_plugins_security.py'
- 'tests/test_metadata_contract.py'
- 'tests/test_pipeline_dependency_policy.py'
- 'tests/test_outbound_payload_safety.py'
- 'scripts/focused_gate.py'
- 'scripts/focused_gate.sh'
- 'scripts/phase2_gate.py'
- 'scripts/phase2_gate.sh'
- 'web/**/*.js'
- 'tests/e2e/**/*.js'
- '.github/workflows/focused-regression-gate.yml'
pull_request:
branches:
- main
- dev
paths:
- 'pipeline/**/*.py'
- 'sanitizer.py'
- 'outbound.py'
- 'config.py'
- '__init__.py'
- 'tests/test_plugins_security.py'
- 'tests/test_metadata_contract.py'
- 'tests/test_pipeline_dependency_policy.py'
- 'tests/test_outbound_payload_safety.py'
- 'scripts/focused_gate.py'
- 'scripts/focused_gate.sh'
- 'scripts/phase2_gate.py'
- 'scripts/phase2_gate.sh'
- 'web/**/*.js'
- 'tests/e2e/**/*.js'
- '.github/workflows/focused-regression-gate.yml'
workflow_dispatch:
inputs:
run_integration_e2e:
description: 'Run optional telemetry integration E2E suite'
required: false
default: false
type: boolean
comfyui_url:
description: 'ComfyUI backend URL for optional integration suite'
required: false
default: 'http://127.0.0.1:8188'
type: string
permissions:
contents: read
jobs:
focused-python-gate:
name: Focused Python Security & Contract Tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: |
pyproject.toml
pytest.ini
- name: Install dependencies
run: |
python scripts/check_supply_chain.py --skip-install-trees
pip install pytest jsonschema
- name: Run Plugin Security Suite
run: |
pytest -q tests/test_plugins_security.py --tb=short
timeout-minutes: 2
- name: Run Metadata Contract Suite
run: |
pytest -q tests/test_metadata_contract.py --tb=short
timeout-minutes: 1
- name: Run Dependency Policy Suite
run: |
pytest -q tests/test_pipeline_dependency_policy.py --tb=short
timeout-minutes: 1
- name: Run Outbound Payload Safety Suite
run: |
pytest -q tests/test_outbound_payload_safety.py --tb=short
timeout-minutes: 1
- name: Summary
if: success()
run: |
echo "✅ Focused Python Gate Passed"
echo "- Plugin security: PASS"
echo "- Metadata contract: PASS"
echo "- Dependency policy: PASS"
echo "- Outbound payload safety: PASS"
focused-e2e-gate:
name: Focused E2E Regression Tests (Required)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Supply-chain dependency gate
run: |
python scripts/check_supply_chain.py --skip-install-trees
- name: Install npm dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Run E2E tests
run: npm test
env:
CI: true
timeout-minutes: 8
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7
- name: Upload screenshots on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-screenshots
path: test-results/
retention-days: 7
- name: Summary
if: success()
run: |
echo "✅ Focused Required E2E Gate Passed"
echo "- Preact loader: PASS"
echo "- Settings UI: PASS"
echo "- Statistics UI: PASS"
echo "- Sidebar UI: PASS"
echo "- Integration-tagged E2E: excluded by design"
focused-e2e-integration-optional:
name: Focused E2E Integration (Optional)
runs-on: ubuntu-latest
timeout-minutes: 10
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_integration_e2e == 'true') ||
(vars.RUN_INTEGRATION_E2E == 'true')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Supply-chain dependency gate
run: |
python scripts/check_supply_chain.py --skip-install-trees
- name: Install npm dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Run optional integration E2E tests
run: npm run test:integration
env:
CI: true
COMFYUI_URL: ${{ github.event.inputs.comfyui_url || vars.COMFYUI_URL || 'http://127.0.0.1:8188' }}
timeout-minutes: 8
- name: Upload integration report
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report-integration
path: playwright-report/
retention-days: 7
- name: Upload integration screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-screenshots-integration
path: test-results/
retention-days: 7
- name: Summary
if: success()
run: |
echo "✅ Optional integration E2E suite completed"
echo "- Command: npm run test:integration"
echo "- Backend URL: ${{ github.event.inputs.comfyui_url || vars.COMFYUI_URL || 'http://127.0.0.1:8188' }}"
echo "- This job does not block release gate."
focused-gate-complete:
name: Focused Gate Complete
runs-on: ubuntu-latest
needs: [focused-python-gate, focused-e2e-gate]
if: always()
steps:
- name: Check gate status
run: |
if [[ "${{ needs.focused-python-gate.result }}" == "success" ]] && [[ "${{ needs.focused-e2e-gate.result }}" == "success" ]]; then
echo "✅ Focused Regression Gate: ALL CHECKS PASSED"
echo ""
echo "Security & Governance:"
echo " ✅ Plugin security (10 tests)"
echo " ✅ Metadata contract (1 test)"
echo " ✅ Dependency policy (2 tests)"
echo " ✅ Outbound payload safety (4 tests)"
echo ""
echo "Frontend Regression (Required):"
echo " ✅ E2E tests (npm test)"
echo ""
echo "Optional Integration:"
echo " ℹ️ E2E integration suite is separate and non-blocking"
echo ""
echo "This change is safe to merge."
exit 0
else
echo "❌ Focused Regression Gate: FAILED"
echo ""
echo "Python Gate: ${{ needs.focused-python-gate.result }}"
echo "E2E Gate: ${{ needs.focused-e2e-gate.result }}"
echo ""
echo "Please fix the failing checks before merging."
exit 1
fi