blob: 3654bb63e88e2b7c26247c8a4cb47b8cdb7e8a87 [file] [log] [blame]
Eric Ball6f17fcb2026-03-04 18:00:51 -08001---
2# SPDX-License-Identifier: Apache-2.0
3# SPDX-FileCopyrightText: 2025 Open Networking Foundation Contributors
4
5name: BBSim Tests Example
6
7on:
8 # Run on push to main branches
9 push:
10 branches:
11 - master
12 - "voltha-*"
13
14 # Run on pull requests
15 pull_request:
16 branches:
17 - master
18 - "voltha-*"
19
20 # Allow manual triggering with custom parameters
21 workflow_dispatch:
22 inputs:
23 branch:
24 description: "Branch to test"
25 required: true
26 default: "master"
27 type: choice
28 options:
29 - master
30 - voltha-2.15
31 workflow_type:
32 description: "Workflow to test"
33 required: true
34 default: "all"
35 type: choice
36 options:
37 - all
38 - dt
39 - att
40 - tt
41 log_level:
42 description: "Log level"
43 required: false
44 default: "WARN"
45 type: choice
46 options:
47 - DEBUG
48 - INFO
49 - WARN
50 - ERROR
51 with_monitoring:
52 description: "Enable monitoring"
53 required: false
54 default: false
55 type: boolean
56
57 # Run nightly
58 schedule:
59 - cron: "0 2 * * *" # 2 AM UTC daily
60
61jobs:
62 # -----------------------------------------------------------------------
63 # Job: DT Workflow Tests
64 # -----------------------------------------------------------------------
65 dt-tests:
66 name: DT Workflow Tests
67 runs-on: ubuntu-latest
68 timeout-minutes: 240
69 if: |
70 github.event_name == 'schedule' ||
71 (github.event_name == 'workflow_dispatch' &&
72 (github.event.inputs.workflow_type == 'dt' || github.event.inputs.workflow_type == 'all')) ||
73 github.event_name == 'push' ||
74 github.event_name == 'pull_request'
75
76 steps:
77 - name: Free up disk space
78 run: |
79 echo "Disk space before cleanup:"
80 df -h
81
82 # Remove unnecessary software
83 sudo rm -rf /usr/share/dotnet
84 sudo rm -rf /opt/ghc
85 sudo rm -rf /usr/local/share/boost
86 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
87
88 echo "Disk space after cleanup:"
89 df -h
90
91 - name: Run DT BBSim Tests
92 uses: opencord/shared-workflows/.github/actions/bbsim-tests@main
93 with:
94 branch: ${{ github.event.inputs.branch || 'master' }}
95 log-level: ${{ github.event.inputs.log_level || 'WARN' }}
96 with-monitoring: ${{ github.event.inputs.with_monitoring || false }}
97 test-targets: |
98 - target: functional-single-kind-dt
99 workflow: dt
100 flags: ""
101 teardown: true
102 logging: true
103 vgcEnabled: false
104
105 - name: Upload test results
106 if: always()
107 uses: actions/upload-artifact@v4
108 with:
109 name: dt-test-results-${{ github.run_id }}
110 path: logs/
111 retention-days: 30
112
113 # -----------------------------------------------------------------------
114 # Job: ATT Workflow Tests
115 # -----------------------------------------------------------------------
116 att-tests:
117 name: ATT Workflow Tests
118 runs-on: ubuntu-latest
119 timeout-minutes: 240
120 if: |
121 github.event_name == 'schedule' ||
122 (github.event_name == 'workflow_dispatch' &&
123 (github.event.inputs.workflow_type == 'att' || github.event.inputs.workflow_type == 'all'))
124
125 steps:
126 - name: Free up disk space
127 run: |
128 echo "Disk space before cleanup:"
129 df -h
130
131 sudo rm -rf /usr/share/dotnet
132 sudo rm -rf /opt/ghc
133 sudo rm -rf /usr/local/share/boost
134 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
135
136 echo "Disk space after cleanup:"
137 df -h
138
139 - name: Run ATT BBSim Tests
140 uses: opencord/shared-workflows/.github/actions/bbsim-tests@main
141 with:
142 branch: ${{ github.event.inputs.branch || 'master' }}
143 log-level: ${{ github.event.inputs.log_level || 'WARN' }}
144 with-monitoring: ${{ github.event.inputs.with_monitoring || false }}
145 test-targets: |
146 - target: functional-single-kind-att
147 workflow: att
148 flags: ""
149 teardown: true
150 logging: true
151 vgcEnabled: false
152
153 - name: Upload test results
154 if: always()
155 uses: actions/upload-artifact@v4
156 with:
157 name: att-test-results-${{ github.run_id }}
158 path: logs/
159 retention-days: 30
160
161 # -----------------------------------------------------------------------
162 # Job: TT Workflow Tests
163 # -----------------------------------------------------------------------
164 tt-tests:
165 name: TT Workflow Tests
166 runs-on: ubuntu-latest
167 timeout-minutes: 240
168 if: |
169 github.event_name == 'schedule' ||
170 (github.event_name == 'workflow_dispatch' &&
171 (github.event.inputs.workflow_type == 'tt' || github.event.inputs.workflow_type == 'all'))
172
173 steps:
174 - name: Free up disk space
175 run: |
176 echo "Disk space before cleanup:"
177 df -h
178
179 sudo rm -rf /usr/share/dotnet
180 sudo rm -rf /opt/ghc
181 sudo rm -rf /usr/local/share/boost
182 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
183
184 echo "Disk space after cleanup:"
185 df -h
186
187 - name: Run TT BBSim Tests
188 uses: opencord/shared-workflows/.github/actions/bbsim-tests@main
189 with:
190 branch: ${{ github.event.inputs.branch || 'master' }}
191 log-level: ${{ github.event.inputs.log_level || 'WARN' }}
192 with-monitoring: ${{ github.event.inputs.with_monitoring || false }}
193 test-targets: |
194 - target: functional-single-kind-tt
195 workflow: tt
196 flags: ""
197 teardown: true
198 logging: true
199 vgcEnabled: false
200
201 - name: Upload test results
202 if: always()
203 uses: actions/upload-artifact@v4
204 with:
205 name: tt-test-results-${{ github.run_id }}
206 path: logs/
207 retention-days: 30
208
209 # -----------------------------------------------------------------------
210 # Job: Multi-workflow Tests (run multiple workflows in sequence)
211 # -----------------------------------------------------------------------
212 multi-workflow-tests:
213 name: Multi-Workflow Tests
214 runs-on: ubuntu-latest
215 timeout-minutes: 480
216 if: github.event_name == 'workflow_dispatch' && github.event.inputs.workflow_type == 'all'
217
218 steps:
219 - name: Free up disk space
220 run: |
221 echo "Disk space before cleanup:"
222 df -h
223
224 sudo rm -rf /usr/share/dotnet
225 sudo rm -rf /opt/ghc
226 sudo rm -rf /usr/local/share/boost
227 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
228
229 echo "Disk space after cleanup:"
230 df -h
231
232 - name: Run All Workflow Tests
233 uses: opencord/shared-workflows/.github/actions/bbsim-tests@main
234 with:
235 branch: ${{ github.event.inputs.branch || 'master' }}
236 log-level: ${{ github.event.inputs.log_level || 'INFO' }}
237 with-monitoring: true
238 olts: "2"
239 test-targets: |
240 - target: sanity-single-kind
241 workflow: dt
242 flags: ""
243 teardown: true
244 logging: true
245 vgcEnabled: false
246 - target: functional-single-kind-dt
247 workflow: dt
248 flags: ""
249 teardown: true
250 logging: true
251 vgcEnabled: false
252 - target: functional-single-kind-att
253 workflow: att
254 flags: ""
255 teardown: true
256 logging: true
257 vgcEnabled: false
258 - target: functional-single-kind-tt
259 workflow: tt
260 flags: ""
261 teardown: true
262 logging: true
263 vgcEnabled: false
264
265 - name: Upload test results
266 if: always()
267 uses: actions/upload-artifact@v4
268 with:
269 name: multi-workflow-test-results-${{ github.run_id }}
270 path: logs/
271 retention-days: 30
272
273 # -----------------------------------------------------------------------
274 # Job: Test Gerrit Patch
275 # -----------------------------------------------------------------------
276 test-patch:
277 name: Test Gerrit Patch
278 runs-on: ubuntu-latest
279 timeout-minutes: 240
280 # Only run when triggered manually with patch information
281 if: |
282 github.event_name == 'workflow_dispatch' &&
283 github.event.inputs.gerrit_project != '' &&
284 github.event.inputs.gerrit_refspec != ''
285
286 steps:
287 - name: Free up disk space
288 run: |
289 sudo rm -rf /usr/share/dotnet
290 sudo rm -rf /opt/ghc
291 sudo rm -rf /usr/local/share/boost
292 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
293
294 - name: Test Patch with BBSim
295 uses: opencord/shared-workflows/.github/actions/bbsim-tests@main
296 with:
297 branch: ${{ github.event.inputs.branch || 'master' }}
298 gerrit-project: ${{ github.event.inputs.gerrit_project }}
299 gerrit-refspec: ${{ github.event.inputs.gerrit_refspec }}
300 log-level: DEBUG
301 test-targets: |
302 - target: sanity-single-kind
303 workflow: dt
304 flags: ""
305 teardown: true
306 logging: true
307 vgcEnabled: false
308
309 - name: Upload test results
310 if: always()
311 uses: actions/upload-artifact@v4
312 with:
313 name: patch-test-results-${{ github.run_id }}
314 path: logs/
315 retention-days: 30
316
317 # -----------------------------------------------------------------------
318 # Job: Report Results
319 # -----------------------------------------------------------------------
320 report:
321 name: Test Results Summary
322 runs-on: ubuntu-latest
323 needs: [dt-tests, att-tests, tt-tests]
324 if: always()
325
326 steps:
327 - name: Download all artifacts
328 uses: actions/download-artifact@v4
329 with:
330 path: all-results
331
332 - name: Generate summary report
333 run: |
334 echo "# BBSim Test Results Summary" >> $GITHUB_STEP_SUMMARY
335 echo "" >> $GITHUB_STEP_SUMMARY
336 echo "## Test Execution" >> $GITHUB_STEP_SUMMARY
337 echo "" >> $GITHUB_STEP_SUMMARY
338 echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
339 echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
340 echo "| DT Tests | ${{ needs.dt-tests.result }} |" >> $GITHUB_STEP_SUMMARY
341 echo "| ATT Tests | ${{ needs.att-tests.result }} |" >> $GITHUB_STEP_SUMMARY
342 echo "| TT Tests | ${{ needs.tt-tests.result }} |" >> $GITHUB_STEP_SUMMARY
343 echo "" >> $GITHUB_STEP_SUMMARY
344
345 # List available artifacts
346 echo "## Artifacts" >> $GITHUB_STEP_SUMMARY
347 echo "" >> $GITHUB_STEP_SUMMARY
348 if [ -d "all-results" ]; then
349 find all-results -type f -name "*.html" | while read file; do
350 echo "- $(basename $file)" >> $GITHUB_STEP_SUMMARY
351 done
352 fi
353
354 - name: Check overall status
355 run: |
356 if [[ "${{ needs.dt-tests.result }}" != "success" ]] || \
357 [[ "${{ needs.att-tests.result }}" != "success" && "${{ needs.att-tests.result }}" != "skipped" ]] || \
358 [[ "${{ needs.tt-tests.result }}" != "success" && "${{ needs.tt-tests.result }}" != "skipped" ]]; then
359 echo "One or more test jobs failed"
360 exit 1
361 fi
362 echo "All executed tests passed successfully"