installer-checks.yml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. env:
  95. OPENCODE_BRANCH: ${{ github.head_ref || github.ref_name }}
  96. run: bash scripts/tests/test-e2e-install.sh
  97. - name: Summary
  98. if: success()
  99. run: |
  100. echo "## ✅ E2E Tests Passed (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
  101. echo "Full installation workflow validated" >> $GITHUB_STEP_SUMMARY
  102. compatibility-tests:
  103. name: Compatibility Tests
  104. runs-on: ${{ matrix.os }}
  105. needs: [shellcheck, syntax-check]
  106. strategy:
  107. matrix:
  108. os: [ubuntu-latest, macos-latest]
  109. steps:
  110. - name: Checkout code
  111. uses: actions/checkout@v4
  112. - name: Install jq (Ubuntu)
  113. if: matrix.os == 'ubuntu-latest'
  114. run: sudo apt-get install -y jq
  115. - name: Install jq (macOS)
  116. if: matrix.os == 'macos-latest'
  117. run: brew install jq || true
  118. - name: Run compatibility tests
  119. run: bash scripts/tests/test-compatibility.sh
  120. - name: Summary
  121. if: success()
  122. run: |
  123. echo "## ✅ Compatibility Tests Passed (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
  124. echo "Platform compatibility validated" >> $GITHUB_STEP_SUMMARY
  125. profile-smoke-test:
  126. name: Profile Installation Smoke Test
  127. runs-on: ubuntu-latest
  128. needs: [non-interactive-tests]
  129. strategy:
  130. matrix:
  131. profile: [essential, developer, business, full]
  132. steps:
  133. - name: Checkout code
  134. uses: actions/checkout@v4
  135. - name: Install dependencies
  136. run: sudo apt-get install -y jq curl
  137. - name: Test ${{ matrix.profile }} profile
  138. env:
  139. OPENCODE_BRANCH: ${{ github.head_ref || github.ref_name }}
  140. run: |
  141. TEST_DIR="/tmp/profile-test-${{ matrix.profile }}"
  142. mkdir -p "$TEST_DIR"
  143. echo "Installing ${{ matrix.profile }} profile..."
  144. bash install.sh ${{ matrix.profile }} --install-dir="$TEST_DIR/.opencode"
  145. if [ -d "$TEST_DIR/.opencode/agent" ]; then
  146. echo "✅ Profile ${{ matrix.profile }} installed successfully"
  147. echo "Files installed:"
  148. find "$TEST_DIR/.opencode" -type f -name "*.md" | head -10
  149. else
  150. echo "❌ Profile ${{ matrix.profile }} failed"
  151. exit 1
  152. fi
  153. - name: Summary
  154. if: success()
  155. run: |
  156. echo "## ✅ Profile Test: ${{ matrix.profile }}" >> $GITHUB_STEP_SUMMARY
  157. echo "Profile installed successfully via non-interactive mode" >> $GITHUB_STEP_SUMMARY
  158. summary:
  159. name: Installer Checks Summary
  160. runs-on: ubuntu-latest
  161. needs: [shellcheck, syntax-check, non-interactive-tests, e2e-tests, compatibility-tests, profile-smoke-test]
  162. if: always()
  163. steps:
  164. - name: Generate summary
  165. run: |
  166. echo "## 📊 Installer Checks Summary" >> $GITHUB_STEP_SUMMARY
  167. echo "" >> $GITHUB_STEP_SUMMARY
  168. if [ "${{ needs.shellcheck.result }}" == "success" ]; then
  169. echo "✅ **ShellCheck:** Passed" >> $GITHUB_STEP_SUMMARY
  170. else
  171. echo "❌ **ShellCheck:** Failed" >> $GITHUB_STEP_SUMMARY
  172. fi
  173. if [ "${{ needs.syntax-check.result }}" == "success" ]; then
  174. echo "✅ **Syntax Check:** Passed" >> $GITHUB_STEP_SUMMARY
  175. else
  176. echo "❌ **Syntax Check:** Failed" >> $GITHUB_STEP_SUMMARY
  177. fi
  178. if [ "${{ needs.non-interactive-tests.result }}" == "success" ]; then
  179. echo "✅ **Non-Interactive Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
  180. else
  181. echo "❌ **Non-Interactive Tests:** Failed" >> $GITHUB_STEP_SUMMARY
  182. fi
  183. if [ "${{ needs.e2e-tests.result }}" == "success" ]; then
  184. echo "✅ **E2E Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
  185. else
  186. echo "❌ **E2E Tests:** Failed" >> $GITHUB_STEP_SUMMARY
  187. fi
  188. if [ "${{ needs.compatibility-tests.result }}" == "success" ]; then
  189. echo "✅ **Compatibility Tests:** Passed (Ubuntu & macOS)" >> $GITHUB_STEP_SUMMARY
  190. else
  191. echo "❌ **Compatibility Tests:** Failed" >> $GITHUB_STEP_SUMMARY
  192. fi
  193. if [ "${{ needs.profile-smoke-test.result }}" == "success" ]; then
  194. echo "✅ **Profile Smoke Tests:** All profiles work" >> $GITHUB_STEP_SUMMARY
  195. else
  196. echo "❌ **Profile Smoke Tests:** Some profiles failed" >> $GITHUB_STEP_SUMMARY
  197. fi
  198. echo "" >> $GITHUB_STEP_SUMMARY
  199. FAILED=0
  200. [ "${{ needs.shellcheck.result }}" != "success" ] && FAILED=1
  201. [ "${{ needs.syntax-check.result }}" != "success" ] && FAILED=1
  202. [ "${{ needs.non-interactive-tests.result }}" != "success" ] && FAILED=1
  203. [ "${{ needs.e2e-tests.result }}" != "success" ] && FAILED=1
  204. if [ $FAILED -eq 0 ]; then
  205. echo "### ✅ All Installer Checks Passed!" >> $GITHUB_STEP_SUMMARY
  206. echo "The installer is safe to merge." >> $GITHUB_STEP_SUMMARY
  207. else
  208. echo "### ❌ Some Checks Failed" >> $GITHUB_STEP_SUMMARY
  209. echo "Please fix failing checks before merging." >> $GITHUB_STEP_SUMMARY
  210. fi