Skip to content

Commit 5152688

Browse files
committed
Batch 2 phase 2 test
1 parent f60c033 commit 5152688

36 files changed

+7462
-194
lines changed

.github/workflows/test-5G-RAL.yml

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -102,38 +102,21 @@ jobs:
102102
END_TIME=$(date +%s)
103103
echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT
104104
105-
- name: Test 3 - Run Internal Tests
105+
- name: Test 3 - Run Internal Tests (via ctest)
106106
id: test3
107107
continue-on-error: true
108108
run: |
109109
START_TIME=$(date +%s)
110110
111-
# Look for test binary in build directory structure
112-
# Based on logs, we expect binaries like 'polar_awgn', 'ldpc_awgn', 'turbo_awgn'
113-
TEST_BIN=$(find $BUILD_PATH -name "polar_awgn" -type f -executable | head -n 1)
114-
115-
if [ -n "$TEST_BIN" ]; then
116-
echo "Found test binary: $TEST_BIN"
117-
# Run the test binary - assume it runs basic validation
118-
if "$TEST_BIN" >/dev/null 2>&1; then
119-
echo "✓ polar_awgn executed successfully"
120-
echo "status=passed" >> $GITHUB_OUTPUT
121-
else
122-
echo "✗ polar_awgn execution failed"
123-
echo "status=failed" >> $GITHUB_OUTPUT
124-
exit 1
125-
fi
111+
cd $BUILD_PATH
112+
echo "Running tests using ctest..."
113+
if ctest --output-on-failure; then
114+
echo "✓ All internal tests passed"
115+
echo "status=passed" >> $GITHUB_OUTPUT
126116
else
127-
# Failover check for other binaries
128-
TEST_BIN_2=$(find $BUILD_PATH -name "ldpc_awgn" -type f -executable | head -n 1)
129-
if [ -n "$TEST_BIN_2" ]; then
130-
echo "Found fallback binary: $TEST_BIN_2"
131-
echo "status=passed" >> $GITHUB_OUTPUT
132-
else
133-
echo "✗ No test artifacts (polar_awgn/ldpc_awgn) found"
134-
echo "status=failed" >> $GITHUB_OUTPUT
135-
exit 1
136-
fi
117+
echo "✗ Internal tests failed"
118+
echo "status=failed" >> $GITHUB_OUTPUT
119+
exit 1
137120
fi
138121
139122
END_TIME=$(date +%s)

.github/workflows/test-_index.yml

Lines changed: 343 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
# Package Test Template
2+
#
3+
# This is a TEMPLATE file stored in the tests/ directory - it will not run as a workflow.
4+
# To use it:
5+
# 1. Copy this file to .github/workflows/test-<your-package>.yml
6+
# 2. Replace all _index placeholders with your package name (e.g., "Redis")
7+
# 3. Replace all _index placeholders with your package slug (lowercase, e.g., "redis")
8+
# 4. Update the install commands for your package
9+
# 5. Update the version detection command
10+
# 6. Add/modify/remove test steps as needed
11+
# 7. Update package metadata in the JSON generation step
12+
# 8. Uncomment the appropriate trigger(s) in the 'on:' section
13+
#
14+
# See .github/workflows/test-nginx.yml and test-envoy.yml for real examples. Template
15+
#
16+
# This is a TEMPLATE file - it will not run automatically.
17+
# To use it:
18+
# 1. Copy this file to test-<your-package>.yml
19+
# 2. Replace all _index placeholders with your package name (e.g., "Redis")
20+
# 3. Replace all _index placeholders with your package slug (lowercase, e.g., "redis")
21+
# 4. Update the install commands for your package
22+
# 5. Update the version detection command
23+
# 6. Add/modify/remove test steps as needed
24+
# 7. Update package metadata in the JSON generation step
25+
# 8. Uncomment the 'push:' trigger section below (remove the workflow_dispatch if desired)
26+
#
27+
# See test-nginx.yml and test-envoy.yml for real examples.
28+
29+
name: Test _index on Arm64
30+
31+
# This is a TEMPLATE - it has no triggers and will not run.
32+
# When you copy this file, uncomment the appropriate triggers below:
33+
on:
34+
# workflow_dispatch: # Uncomment for manual testing
35+
# workflow_call: # Uncomment if called by other workflows
36+
push:
37+
branches:
38+
- main
39+
- smoke_tests
40+
paths:
41+
- 'content/opensource_packages/_index.md'
42+
- '.github/workflows/test-_index.yml'
43+
44+
jobs:
45+
test-_index:
46+
runs-on: ubuntu-24.04-arm
47+
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
52+
- name: Set test metadata
53+
id: metadata
54+
run: |
55+
echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
56+
echo "package_slug=_index" >> $GITHUB_OUTPUT
57+
echo "dashboard_link=/opensource_packages/_index" >> $GITHUB_OUTPUT
58+
59+
# ============================================================
60+
# CUSTOMIZE THIS: Install your package
61+
# ============================================================
62+
- name: Install _index
63+
id: install
64+
run: |
65+
echo "Installing _index..."
66+
67+
# Example for apt packages:
68+
sudo apt-get update
69+
sudo apt-get install -y _index
70+
71+
# Example for downloading binaries:
72+
# sudo curl -L -o /usr/local/bin/_index https://github.com/org/repo/releases/download/v1.0.0/_index-linux-arm64
73+
# sudo chmod +x /usr/local/bin/_index
74+
75+
# Verify installation
76+
if command -v _index &> /dev/null; then
77+
echo "_index installed successfully"
78+
echo "install_status=success" >> $GITHUB_OUTPUT
79+
else
80+
echo "_index installation failed"
81+
echo "install_status=failed" >> $GITHUB_OUTPUT
82+
exit 1
83+
fi
84+
85+
# ============================================================
86+
# CUSTOMIZE THIS: Get the package version
87+
# ============================================================
88+
- name: Get _index version
89+
id: version
90+
run: |
91+
# Adjust this command based on how your package reports version
92+
VERSION=$(_index --version 2>&1 | grep -oP '[0-9.]+' | head -1 || echo "unknown")
93+
echo "version=$VERSION" >> $GITHUB_OUTPUT
94+
echo "Detected _index version: $VERSION"
95+
96+
# ============================================================
97+
# ADD YOUR TESTS BELOW
98+
# Each test should:
99+
# 1. Have a unique id (test1, test2, etc.)
100+
# 2. Track start/end time for duration
101+
# 3. Set status=passed or status=failed
102+
# 4. Exit 1 on failure
103+
# ============================================================
104+
105+
- name: Test 1 - Check _index binary exists
106+
id: test1
107+
run: |
108+
START_TIME=$(date +%s)
109+
110+
if command -v _index &> /dev/null; then
111+
echo "✓ _index binary found"
112+
echo "status=passed" >> $GITHUB_OUTPUT
113+
else
114+
echo "✗ _index binary not found"
115+
echo "status=failed" >> $GITHUB_OUTPUT
116+
exit 1
117+
fi
118+
119+
END_TIME=$(date +%s)
120+
echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT
121+
122+
- name: Test 2 - Check _index version command
123+
id: test2
124+
run: |
125+
START_TIME=$(date +%s)
126+
127+
if _index --version 2>&1 | grep -q "version\|[0-9]"; then
128+
echo "✓ _index version command works"
129+
_index --version
130+
echo "status=passed" >> $GITHUB_OUTPUT
131+
else
132+
echo "✗ _index version command failed"
133+
echo "status=failed" >> $GITHUB_OUTPUT
134+
exit 1
135+
fi
136+
137+
END_TIME=$(date +%s)
138+
echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT
139+
140+
- name: Test 3 - Check _index help output
141+
id: test3
142+
run: |
143+
START_TIME=$(date +%s)
144+
145+
if _index --help 2>&1 | grep -qi "usage\|help\|options"; then
146+
echo "✓ _index help command works"
147+
echo "status=passed" >> $GITHUB_OUTPUT
148+
else
149+
echo "✗ _index help command failed"
150+
echo "status=failed" >> $GITHUB_OUTPUT
151+
exit 1
152+
fi
153+
154+
END_TIME=$(date +%s)
155+
echo "duration=$((END_TIME - START_TIME))" >> $GITHUB_OUTPUT
156+
157+
# Add more tests as needed (test4, test5, etc.)
158+
# Examples:
159+
# - Run a simple command
160+
# - Check configuration files
161+
# - Start/stop a service
162+
# - Test basic functionality
163+
164+
# ============================================================
165+
# UPDATE THIS: Calculate summary based on your number of tests
166+
# Add/remove test result checks to match your tests above
167+
# ============================================================
168+
- name: Calculate test summary
169+
if: always()
170+
id: summary
171+
run: |
172+
PASSED=0
173+
FAILED=0
174+
TOTAL_DURATION=0
175+
176+
# Test 1
177+
if [ "${{ steps.test1.outputs.status }}" == "passed" ]; then
178+
PASSED=$((PASSED + 1))
179+
else
180+
FAILED=$((FAILED + 1))
181+
fi
182+
TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test1.outputs.duration || 0 }}))
183+
184+
# Test 2
185+
if [ "${{ steps.test2.outputs.status }}" == "passed" ]; then
186+
PASSED=$((PASSED + 1))
187+
else
188+
FAILED=$((FAILED + 1))
189+
fi
190+
TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test2.outputs.duration || 0 }}))
191+
192+
# Test 3
193+
if [ "${{ steps.test3.outputs.status }}" == "passed" ]; then
194+
PASSED=$((PASSED + 1))
195+
else
196+
FAILED=$((FAILED + 1))
197+
fi
198+
TOTAL_DURATION=$((TOTAL_DURATION + ${{ steps.test3.outputs.duration || 0 }}))
199+
200+
# Add more tests here if you added test4, test5, etc. above
201+
202+
echo "passed=$PASSED" >> $GITHUB_OUTPUT
203+
echo "failed=$FAILED" >> $GITHUB_OUTPUT
204+
echo "duration=$TOTAL_DURATION" >> $GITHUB_OUTPUT
205+
206+
if [ $FAILED -eq 0 ]; then
207+
echo "overall_status=success" >> $GITHUB_OUTPUT
208+
echo "badge_status=passing" >> $GITHUB_OUTPUT
209+
else
210+
echo "overall_status=failure" >> $GITHUB_OUTPUT
211+
echo "badge_status=failing" >> $GITHUB_OUTPUT
212+
fi
213+
214+
# ============================================================
215+
# UPDATE THIS: Generate JSON with your package metadata and test details
216+
# ============================================================
217+
- name: Generate test results JSON
218+
if: always()
219+
run: |
220+
mkdir -p test-results
221+
222+
cat > test-results/_index.json << EOF
223+
{
224+
"schema_version": "1.0",
225+
"package": {
226+
"name": "_index",
227+
"version": "${{ steps.version.outputs.version }}",
228+
"language": "Unknown",
229+
"category": "Unknown"
230+
},
231+
"run": {
232+
"id": "${{ github.run_id }}",
233+
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
234+
"timestamp": "${{ steps.metadata.outputs.timestamp }}",
235+
"status": "${{ steps.summary.outputs.overall_status }}",
236+
"runner": {
237+
"os": "ubuntu-24.04",
238+
"arch": "arm64"
239+
}
240+
},
241+
"tests": {
242+
"passed": ${{ steps.summary.outputs.passed }},
243+
"failed": ${{ steps.summary.outputs.failed }},
244+
"skipped": 0,
245+
"duration_seconds": ${{ steps.summary.outputs.duration }},
246+
"details": [
247+
{
248+
"name": "Check _index binary exists",
249+
"status": "${{ steps.test1.outputs.status }}",
250+
"duration_seconds": ${{ steps.test1.outputs.duration || 0 }}
251+
},
252+
{
253+
"name": "Check _index version command",
254+
"status": "${{ steps.test2.outputs.status }}",
255+
"duration_seconds": ${{ steps.test2.outputs.duration || 0 }}
256+
},
257+
{
258+
"name": "Check _index help output",
259+
"status": "${{ steps.test3.outputs.status }}",
260+
"duration_seconds": ${{ steps.test3.outputs.duration || 0 }}
261+
}
262+
]
263+
},
264+
"metadata": {
265+
"dashboard_link": "${{ steps.metadata.outputs.dashboard_link }}",
266+
"badge_status": "${{ steps.summary.outputs.badge_status }}"
267+
}
268+
}
269+
EOF
270+
271+
echo "Generated test results:"
272+
cat test-results/_index.json
273+
274+
# ============================================================
275+
# STANDARD STEPS - Usually don't need to modify below here
276+
# ============================================================
277+
278+
- name: Upload test results
279+
if: always()
280+
uses: actions/upload-artifact@v4
281+
with:
282+
name: _index-test-results
283+
path: test-results/_index.json
284+
retention-days: 90
285+
286+
- name: Commit test results to repository
287+
if: always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/smoke_tests')
288+
run: |
289+
git config --global user.name 'github-actions[bot]'
290+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
291+
292+
mkdir -p data/test-results
293+
cp test-results/_index.json data/test-results/_index.json
294+
295+
git add data/test-results/_index.json
296+
297+
if ! git diff --staged --quiet; then
298+
git commit -m "Update _index test results [skip ci]"
299+
300+
# Pull with rebase and push, retry up to 5 times
301+
for i in {1..5}; do
302+
if git pull --rebase origin ${{ github.ref_name }}; then
303+
# Rebase succeeded, try to push
304+
if git push; then
305+
echo "Successfully pushed test results"
306+
break
307+
fi
308+
else
309+
# Rebase failed, likely due to conflict
310+
echo "Rebase failed, resolving conflicts..."
311+
312+
# Accept our version of the file (the new test results)
313+
git checkout --ours data/test-results/_index.json
314+
git add data/test-results/_index.json
315+
316+
# Continue the rebase
317+
git rebase --continue || true
318+
fi
319+
320+
# Wait before retry
321+
echo "Retry attempt $i of 5..."
322+
sleep $((i * 2))
323+
done
324+
else
325+
echo "No changes to commit"
326+
fi
327+
328+
- name: Create test summary
329+
if: always()
330+
run: |
331+
echo "## _index Test Results" >> $GITHUB_STEP_SUMMARY
332+
echo "" >> $GITHUB_STEP_SUMMARY
333+
echo "- **Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
334+
echo "- **Status:** ${{ steps.summary.outputs.overall_status }}" >> $GITHUB_STEP_SUMMARY
335+
echo "- **Tests Passed:** ${{ steps.summary.outputs.passed }}" >> $GITHUB_STEP_SUMMARY
336+
echo "- **Tests Failed:** ${{ steps.summary.outputs.failed }}" >> $GITHUB_STEP_SUMMARY
337+
echo "- **Duration:** ${{ steps.summary.outputs.duration }}s" >> $GITHUB_STEP_SUMMARY
338+
echo "- **Runner:** ubuntu-24.04 (arm64)" >> $GITHUB_STEP_SUMMARY
339+
echo "" >> $GITHUB_STEP_SUMMARY
340+
echo "### Test Details" >> $GITHUB_STEP_SUMMARY
341+
echo "1. Check _index binary exists: ${{ steps.test1.outputs.status }}" >> $GITHUB_STEP_SUMMARY
342+
echo "2. Check _index version command: ${{ steps.test2.outputs.status }}" >> $GITHUB_STEP_SUMMARY
343+
echo "3. Check _index help output: ${{ steps.test3.outputs.status }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)