installer-checks.yml 8.5 KB

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