feat: implement Demo Validation and Enhancement System #7
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: Performance Gates | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| performance-test: | |
| name: Performance Gates | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| - name: Build triageprof | |
| run: go build -o bin/triageprof cmd/triageprof/main.go | |
| - name: Run demo-kit with performance gates | |
| id: performance | |
| run: | | |
| ./bin/triageprof demo-kit --out /tmp/performance-output --duration 10 | |
| # Check if findings.json was generated | |
| if [ -f "/tmp/performance-output/findings.json" ]; then | |
| echo "performance_output=success" >> $GITHUB_OUTPUT | |
| echo "Performance analysis completed successfully" | |
| else | |
| echo "performance_output=failure" >> $GITHUB_OUTPUT | |
| echo "Performance analysis failed - no findings generated" | |
| exit 1 | |
| fi | |
| - name: Check performance thresholds | |
| run: | | |
| # Define performance thresholds (configurable) | |
| CRITICAL_FINDINGS_THRESHOLD=5 | |
| HIGH_FINDINGS_THRESHOLD=10 | |
| # Count findings by severity | |
| CRITICAL_COUNT=$(jq '[.findings[] | select(.severity == "critical")] | length' /tmp/performance-output/findings.json 2>/dev/null || echo "0") | |
| HIGH_COUNT=$(jq '[.findings[] | select(.severity == "high")] | length' /tmp/performance-output/findings.json 2>/dev/null || echo "0") | |
| echo "Critical findings: $CRITICAL_COUNT" | |
| echo "High findings: $HIGH_COUNT" | |
| # Apply performance gates | |
| if [ "$CRITICAL_COUNT" -gt "$CRITICAL_FINDINGS_THRESHOLD" ]; then | |
| echo "::error::Performance gate failed: Too many critical findings ($CRITICAL_COUNT > $CRITICAL_FINDINGS_THRESHOLD)" | |
| exit 1 | |
| fi | |
| if [ "$HIGH_COUNT" -gt "$HIGH_FINDINGS_THRESHOLD" ]; then | |
| echo "::warning::Performance gate warning: High number of high-severity findings ($HIGH_COUNT > $HIGH_FINDINGS_THRESHOLD)" | |
| fi | |
| echo "Performance gates passed successfully" | |
| - name: Upload performance artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: performance-artifacts | |
| path: /tmp/performance-output/ |