installer-checks.yml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. name: Installer Checks
  2. on:
  3. pull_request:
  4. branches: [main]
  5. paths:
  6. - 'install.sh'
  7. - 'update.sh'
  8. - 'registry.json'
  9. - 'scripts/tests/test-*.sh'
  10. push:
  11. branches: [main]
  12. paths:
  13. - 'install.sh'
  14. - 'update.sh'
  15. workflow_dispatch:
  16. jobs:
  17. shellcheck:
  18. name: ShellCheck Analysis
  19. runs-on: ubuntu-latest
  20. steps:
  21. - name: Checkout code
  22. uses: actions/checkout@v4
  23. - name: Run ShellCheck on install.sh
  24. uses: ludeeus/action-shellcheck@master
  25. with:
  26. scandir: '.'
  27. additional_files: 'install.sh update.sh'
  28. severity: warning
  29. - name: Summary
  30. if: success()
  31. run: |
  32. echo "## ✅ ShellCheck Passed" >> $GITHUB_STEP_SUMMARY
  33. echo "No shell script issues found in install.sh or update.sh" >> $GITHUB_STEP_SUMMARY
  34. syntax-check:
  35. name: Bash Syntax Validation
  36. runs-on: ubuntu-latest
  37. steps:
  38. - name: Checkout code
  39. uses: actions/checkout@v4
  40. - name: Check install.sh syntax
  41. run: bash -n install.sh
  42. - name: Check update.sh syntax
  43. run: bash -n update.sh
  44. - name: Check test scripts syntax
  45. run: |
  46. for script in scripts/tests/test-*.sh; do
  47. echo "Checking $script..."
  48. bash -n "$script"
  49. done
  50. - name: Summary
  51. run: |
  52. echo "## ✅ Syntax Check Passed" >> $GITHUB_STEP_SUMMARY
  53. echo "All shell scripts have valid syntax" >> $GITHUB_STEP_SUMMARY
  54. non-interactive-tests:
  55. name: Non-Interactive Mode Tests
  56. runs-on: ${{ matrix.os }}
  57. needs: [shellcheck, syntax-check]
  58. strategy:
  59. matrix:
  60. os: [ubuntu-latest, macos-latest]
  61. steps:
  62. - name: Checkout code
  63. uses: actions/checkout@v4
  64. - name: Install jq (Ubuntu)
  65. if: matrix.os == 'ubuntu-latest'
  66. run: sudo apt-get install -y jq
  67. - name: Install jq (macOS)
  68. if: matrix.os == 'macos-latest'
  69. run: brew install jq || true
  70. - name: Run non-interactive tests
  71. run: bash scripts/tests/test-non-interactive.sh
  72. - name: Summary
  73. if: success()
  74. run: |
  75. echo "## ✅ Non-Interactive Tests Passed (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
  76. echo "All piped execution scenarios work correctly" >> $GITHUB_STEP_SUMMARY
  77. e2e-tests:
  78. name: End-to-End Installation Tests
  79. runs-on: ${{ matrix.os }}
  80. needs: [shellcheck, syntax-check]
  81. strategy:
  82. matrix:
  83. os: [ubuntu-latest, macos-latest]
  84. steps:
  85. - name: Checkout code
  86. uses: actions/checkout@v4
  87. - name: Install jq (Ubuntu)
  88. if: matrix.os == 'ubuntu-latest'
  89. run: sudo apt-get install -y jq
  90. - name: Install jq (macOS)
  91. if: matrix.os == 'macos-latest'
  92. run: brew install jq || true
  93. - name: Run E2E tests
  94. run: bash scripts/tests/test-e2e-install.sh
  95. - name: Summary
  96. if: success()
  97. run: |
  98. echo "## ✅ E2E Tests Passed (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
  99. echo "Full installation workflow validated" >> $GITHUB_STEP_SUMMARY
  100. compatibility-tests:
  101. name: Compatibility Tests
  102. runs-on: ${{ matrix.os }}
  103. needs: [shellcheck, syntax-check]
  104. strategy:
  105. matrix:
  106. os: [ubuntu-latest, macos-latest]
  107. steps:
  108. - name: Checkout code
  109. uses: actions/checkout@v4
  110. - name: Install jq (Ubuntu)
  111. if: matrix.os == 'ubuntu-latest'
  112. run: sudo apt-get install -y jq
  113. - name: Install jq (macOS)
  114. if: matrix.os == 'macos-latest'
  115. run: brew install jq || true
  116. - name: Run compatibility tests
  117. run: bash scripts/tests/test-compatibility.sh
  118. - name: Summary
  119. if: success()
  120. run: |
  121. echo "## ✅ Compatibility Tests Passed (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
  122. echo "Platform compatibility validated" >> $GITHUB_STEP_SUMMARY
  123. profile-smoke-test:
  124. name: Profile Installation Smoke Test
  125. runs-on: ubuntu-latest
  126. needs: [non-interactive-tests]
  127. strategy:
  128. matrix:
  129. profile: [essential, developer, business, full]
  130. steps:
  131. - name: Checkout code
  132. uses: actions/checkout@v4
  133. - name: Install dependencies
  134. run: sudo apt-get install -y jq curl
  135. - name: Test ${{ matrix.profile }} profile
  136. run: |
  137. TEST_DIR="/tmp/profile-test-${{ matrix.profile }}"
  138. mkdir -p "$TEST_DIR"
  139. echo "Installing ${{ matrix.profile }} profile..."
  140. bash install.sh ${{ matrix.profile }} --install-dir="$TEST_DIR/.opencode"
  141. if [ -d "$TEST_DIR/.opencode/agent" ]; then
  142. echo "✅ Profile ${{ matrix.profile }} installed successfully"
  143. echo "Files installed:"
  144. find "$TEST_DIR/.opencode" -type f -name "*.md" | head -10
  145. else
  146. echo "❌ Profile ${{ matrix.profile }} failed"
  147. exit 1
  148. fi
  149. - name: Summary
  150. if: success()
  151. run: |
  152. echo "## ✅ Profile Test: ${{ matrix.profile }}" >> $GITHUB_STEP_SUMMARY
  153. echo "Profile installed successfully via non-interactive mode" >> $GITHUB_STEP_SUMMARY
  154. summary:
  155. name: Installer Checks Summary
  156. runs-on: ubuntu-latest
  157. needs: [shellcheck, syntax-check, non-interactive-tests, e2e-tests, compatibility-tests, profile-smoke-test]
  158. if: always()
  159. steps:
  160. - name: Generate summary
  161. run: |
  162. echo "## 📊 Installer Checks Summary" >> $GITHUB_STEP_SUMMARY
  163. echo "" >> $GITHUB_STEP_SUMMARY
  164. if [ "${{ needs.shellcheck.result }}" == "success" ]; then
  165. echo "✅ **ShellCheck:** Passed" >> $GITHUB_STEP_SUMMARY
  166. else
  167. echo "❌ **ShellCheck:** Failed" >> $GITHUB_STEP_SUMMARY
  168. fi
  169. if [ "${{ needs.syntax-check.result }}" == "success" ]; then
  170. echo "✅ **Syntax Check:** Passed" >> $GITHUB_STEP_SUMMARY
  171. else
  172. echo "❌ **Syntax Check:** Failed" >> $GITHUB_STEP_SUMMARY
  173. fi
  174. if [ "${{ needs.non-interactive-tests.result }}" == "success" ]; then
  175. echo "✅ **Non-Interactive Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
  176. else
  177. echo "❌ **Non-Interactive Tests:** Failed" >> $GITHUB_STEP_SUMMARY
  178. fi
  179. if [ "${{ needs.e2e-tests.result }}" == "success" ]; then
  180. echo "✅ **E2E Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
  181. else
  182. echo "❌ **E2E Tests:** Failed" >> $GITHUB_STEP_SUMMARY
  183. fi
  184. if [ "${{ needs.compatibility-tests.result }}" == "success" ]; then
  185. echo "✅ **Compatibility Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
  186. else
  187. echo "❌ **Compatibility Tests:** Failed" >> $GITHUB_STEP_SUMMARY
  188. fi
  189. if [ "${{ needs.profile-smoke-test.result }}" == "success" ]; then
  190. echo "✅ **Profile Smoke Tests:** All profiles work" >> $GITHUB_STEP_SUMMARY
  191. else
  192. echo "❌ **Profile Smoke Tests:** Some profiles failed" >> $GITHUB_STEP_SUMMARY
  193. fi
  194. echo "" >> $GITHUB_STEP_SUMMARY
  195. FAILED=0
  196. [ "${{ needs.shellcheck.result }}" != "success" ] && FAILED=1
  197. [ "${{ needs.syntax-check.result }}" != "success" ] && FAILED=1
  198. [ "${{ needs.non-interactive-tests.result }}" != "success" ] && FAILED=1
  199. [ "${{ needs.e2e-tests.result }}" != "success" ] && FAILED=1
  200. if [ $FAILED -eq 0 ]; then
  201. echo "### ✅ All Installer Checks Passed!" >> $GITHUB_STEP_SUMMARY
  202. echo "The installer is safe to merge." >> $GITHUB_STEP_SUMMARY
  203. else
  204. echo "### ❌ Some Checks Failed" >> $GITHUB_STEP_SUMMARY
  205. echo "Please fix failing checks before merging." >> $GITHUB_STEP_SUMMARY
  206. fi