installer-checks.yml 8.8 KB

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