|
| 1 | +# PRP: GitHub Actions QA Workflow Implementation |
| 2 | + |
| 3 | +**Created:** 2025-01-11 |
| 4 | +**Status:** Ready for Implementation |
| 5 | +**Priority:** High |
| 6 | +**Estimated Complexity:** Medium |
| 7 | + |
| 8 | +## FEATURE: |
| 9 | + |
| 10 | +Implement a GitHub Actions workflow that executes "make qa" as a comprehensive quality assurance pipeline for the flowsh repository. The workflow should run on multiple triggers (push to main, pull requests, commits, manual dispatch) and rely entirely on the existing "make qa" command for validation logic. |
| 11 | + |
| 12 | +**Core Requirements:** |
| 13 | + |
| 14 | +- Execute "make qa" in GitHub Actions environment with ubuntu-latest runner |
| 15 | +- Support multiple trigger events: push to main, pull requests, manual dispatch |
| 16 | +- Install OpenCode following the pattern from nodejs-frontend-preview.yml example |
| 17 | +- Use repository secrets TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID (already configured) |
| 18 | +- Fail the workflow if "make qa" exits with non-zero status |
| 19 | +- Output exactly what "make qa" outputs (no additional processing) |
| 20 | +- Use GitHub CLI "gh" during implementation for validation loop testing |
| 21 | + |
| 22 | +**Integration Points:** |
| 23 | + |
| 24 | +- Leverages existing Makefile QA pipeline that validates: |
| 25 | + - TypeScript compilation and testing (80% coverage requirement) |
| 26 | + - All 35 production templates (basic, enhanced, advanced) |
| 27 | + - All 19+ node examples with execution validation |
| 28 | + - Linting, formatting, and build processes |
| 29 | +- Must work with Node.js 18+ environment and npm dependencies |
| 30 | +- Should complete within reasonable CI/CD time limits |
| 31 | + |
| 32 | +## EXAMPLES: |
| 33 | + |
| 34 | +**Reference Implementation:** |
| 35 | + |
| 36 | +```yaml |
| 37 | +# Based on: https://github.com/tbrandenburg/made/blob/main/.github/workflows/nodejs-frontend-preview.yml |
| 38 | +name: QA Pipeline |
| 39 | +on: |
| 40 | + push: |
| 41 | + branches: [main] |
| 42 | + pull_request: |
| 43 | + branches: [main] |
| 44 | + workflow_dispatch: |
| 45 | + |
| 46 | +jobs: |
| 47 | + qa: |
| 48 | + runs-on: ubuntu-latest |
| 49 | + env: |
| 50 | + TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} |
| 51 | + TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + - uses: actions/setup-node@v4 |
| 55 | + with: |
| 56 | + node-version: '18' |
| 57 | + cache: 'npm' |
| 58 | + - name: Install OpenCode |
| 59 | + run: npm install -g @anomalyco/opencode |
| 60 | + - name: Install Dependencies |
| 61 | + run: npm ci |
| 62 | + - name: Run QA Pipeline |
| 63 | + run: make qa |
| 64 | +``` |
| 65 | +
|
| 66 | +**Existing QA Pipeline (from Makefile):** |
| 67 | +
|
| 68 | +```bash |
| 69 | +# Comprehensive quality assurance pipeline |
| 70 | +# Runs all checks: linting, formatting, unit tests, build, examples, and templates |
| 71 | +qa: check examples-all templates-all |
| 72 | + @echo "🎉 All QA checks passed successfully!" |
| 73 | + |
| 74 | +# Where: |
| 75 | +# - check: lint format test build |
| 76 | +# - examples-all: Generate and execute all 19+ node examples |
| 77 | +# - templates-all: Generate and execute all 35 production templates |
| 78 | +``` |
| 79 | + |
| 80 | +**GitHub CLI Validation Commands:** |
| 81 | + |
| 82 | +```bash |
| 83 | +# Watch workflow runs during validation |
| 84 | +gh run list --workflow=qa-pipeline.yml |
| 85 | +gh run watch <run-id> |
| 86 | +gh run view <run-id> --log |
| 87 | +``` |
| 88 | + |
| 89 | +## DOCUMENTATION: |
| 90 | + |
| 91 | +**GitHub Actions References:** |
| 92 | + |
| 93 | +- [GitHub Actions Workflow Syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) |
| 94 | +- [Node.js Setup Action](https://github.com/actions/setup-node) |
| 95 | +- [Checkout Action v4](https://github.com/actions/checkout) |
| 96 | + |
| 97 | +**Project Context:** |
| 98 | + |
| 99 | +- Current Makefile QA pipeline: `/home/tom/workspace/ai/made/workspace/flowsh/Makefile` (lines 54-56) |
| 100 | +- Reference workflow: https://github.com/tbrandenburg/made/blob/main/.github/workflows/nodejs-frontend-preview.yml |
| 101 | +- Repository secrets already configured: TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID |
| 102 | + |
| 103 | +**OpenCode Installation:** |
| 104 | + |
| 105 | +- Package: `@anomalyco/opencode` (npm global install) |
| 106 | +- Required for template execution and validation processes |
| 107 | + |
| 108 | +**Flowsh QA Requirements:** |
| 109 | + |
| 110 | +- Node.js 18+ (specified in package.json engines) |
| 111 | +- TypeScript compilation with strict mode |
| 112 | +- 80% test coverage threshold (vitest.config.ts) |
| 113 | +- All 35 templates must compile and validate successfully |
| 114 | +- All 19+ node examples must execute without errors |
| 115 | + |
| 116 | +## OTHER CONSIDERATIONS: |
| 117 | + |
| 118 | +**Critical Implementation Requirements:** |
| 119 | + |
| 120 | +1. **No Additional Logic:** Workflow should NOT implement validation logic on top of "make qa" - it should simply execute it and respect its exit code |
| 121 | +2. **Exit Code Handling:** "make qa" must exit with status 1 on failure (verify current implementation) |
| 122 | +3. **Environment Setup:** Ubuntu-latest runner with Node.js 18 and npm caching for performance |
| 123 | +4. **Secret Availability:** TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID must be available as environment variables during execution |
| 124 | + |
| 125 | +**Potential Issues:** |
| 126 | + |
| 127 | +1. **Makefile Exit Codes:** Verify that "make qa" properly exits with non-zero status on any failure |
| 128 | +2. **Template Execution Time:** 35 template executions may take significant time - ensure workflow timeout is appropriate |
| 129 | +3. **Environment Variables:** Some templates may require additional environment setup beyond Telegram secrets |
| 130 | +4. **OpenCode Installation:** Ensure OpenCode installation works in GitHub Actions environment |
| 131 | + |
| 132 | +**Validation Loop Strategy:** |
| 133 | + |
| 134 | +During PRP execution, use GitHub CLI to: |
| 135 | + |
| 136 | +1. Create and push the workflow file |
| 137 | +2. Trigger manual workflow dispatch: `gh workflow run qa-pipeline.yml` |
| 138 | +3. Monitor execution: `gh run watch` |
| 139 | +4. Verify all trigger types work (push, PR, manual) |
| 140 | +5. Confirm failure scenarios work correctly |
| 141 | +6. Validate output matches local "make qa" execution |
| 142 | + |
| 143 | +**Files to Create/Modify:** |
| 144 | + |
| 145 | +1. **Create:** `.github/workflows/qa-pipeline.yml` - Main workflow file |
| 146 | +2. **Verify/Update:** `Makefile` - Ensure "make qa" exits properly on failure |
| 147 | +3. **Test:** Workflow triggers and execution via GitHub CLI |
| 148 | + |
| 149 | +**Success Criteria:** |
| 150 | + |
| 151 | +✅ Workflow triggers correctly on push to main, pull requests, and manual dispatch |
| 152 | +✅ "make qa" executes successfully in GitHub Actions environment |
| 153 | +✅ Workflow fails when "make qa" fails (exit code 1) |
| 154 | +✅ Workflow output matches local "make qa" output |
| 155 | +✅ All 35 templates validate successfully in CI environment |
| 156 | +✅ All 19+ node examples execute successfully in CI environment |
| 157 | +✅ TypeScript tests pass with 80% coverage requirement |
| 158 | +✅ GitHub CLI validation confirms successful workflow execution |
| 159 | +✅ Workflow completes within reasonable time limits (< 10 minutes) |
| 160 | + |
| 161 | +**Performance Considerations:** |
| 162 | + |
| 163 | +- Use npm caching to reduce dependency installation time |
| 164 | +- Consider parallel execution if "make qa" supports it |
| 165 | +- Monitor workflow execution time and optimize if needed |
| 166 | +- Ensure timeout settings allow for complete template validation |
| 167 | + |
| 168 | +**Security Notes:** |
| 169 | + |
| 170 | +- Repository secrets (TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID) are properly configured |
| 171 | +- No additional secret exposure in workflow logs |
| 172 | +- OpenCode installation from official npm package only |
0 commit comments