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