Skip to content

Commit 379a04d

Browse files
Copilotdorkmo
andcommitted
Add persistent structural analysis log file with failure descriptions
Co-authored-by: dorkmo <1923070+dorkmo@users.noreply.github.com>
1 parent b080cd4 commit 379a04d

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

.github/workflows/openscad-structural-analysis.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,130 @@ jobs:
109109
110110
cat structural_report.md
111111
112+
- name: Create persistent structural analysis log
113+
run: |
114+
cd LifeTrac-v25/mechanical_design
115+
116+
# Create or update the persistent log file
117+
echo "# Structural Analysis Test Log" > STRUCTURAL_ANALYSIS_LOG.md
118+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
119+
echo "This file tracks the history of structural analysis test results." >> STRUCTURAL_ANALYSIS_LOG.md
120+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
121+
echo "---" >> STRUCTURAL_ANALYSIS_LOG.md
122+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
123+
echo "## Latest Analysis" >> STRUCTURAL_ANALYSIS_LOG.md
124+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
125+
echo "**Date:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> STRUCTURAL_ANALYSIS_LOG.md
126+
echo "**Commit:** ${{ github.sha }}" >> STRUCTURAL_ANALYSIS_LOG.md
127+
echo "**Branch:** ${{ github.ref_name }}" >> STRUCTURAL_ANALYSIS_LOG.md
128+
echo "**Workflow Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> STRUCTURAL_ANALYSIS_LOG.md
129+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
130+
131+
# Extract and format the structural analysis results
132+
if grep -q "COMPLETE STRUCTURAL ANALYSIS SUMMARY" structural_analysis.log; then
133+
echo "### Results Summary" >> STRUCTURAL_ANALYSIS_LOG.md
134+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
135+
echo "\`\`\`" >> STRUCTURAL_ANALYSIS_LOG.md
136+
sed -n '/COMPLETE STRUCTURAL ANALYSIS SUMMARY/,/========================================/{p;/========================================/q}' structural_analysis.log | tail -n +2 >> STRUCTURAL_ANALYSIS_LOG.md || \
137+
sed -n '/COMPLETE STRUCTURAL ANALYSIS SUMMARY/,$p' structural_analysis.log | tail -n +2 | head -n 20 >> STRUCTURAL_ANALYSIS_LOG.md
138+
echo "\`\`\`" >> STRUCTURAL_ANALYSIS_LOG.md
139+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
140+
141+
# Extract detailed failure information if any tests failed
142+
if grep -q "FAIL" structural_analysis.log; then
143+
echo "### ⚠️ Failed Components" >> STRUCTURAL_ANALYSIS_LOG.md
144+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
145+
146+
# Extract rated capacity
147+
CAPACITY=$(grep "RATED LIFT CAPACITY:" structural_analysis.log | head -1 | sed 's/ECHO: "RATED LIFT CAPACITY:", //')
148+
echo "**Current Rated Capacity:** $CAPACITY" >> STRUCTURAL_ANALYSIS_LOG.md
149+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
150+
151+
# List each failed component with details
152+
echo "#### Detailed Failure Analysis" >> STRUCTURAL_ANALYSIS_LOG.md
153+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
154+
155+
# Arm Bending
156+
if grep -q "Arm Bending.*FAIL" structural_analysis.log; then
157+
echo "**1. Arm Bending Stress**" >> STRUCTURAL_ANALYSIS_LOG.md
158+
grep -A 5 "=== ARM BENDING STRESS ANALYSIS ===" structural_analysis.log | grep "ECHO:" | sed 's/ECHO: /- /' >> STRUCTURAL_ANALYSIS_LOG.md
159+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
160+
fi
161+
162+
# Arm Deflection
163+
if grep -q "Arm Deflection.*FAIL" structural_analysis.log; then
164+
echo "**2. Arm Deflection**" >> STRUCTURAL_ANALYSIS_LOG.md
165+
grep -A 5 "=== ARM DEFLECTION ANALYSIS ===" structural_analysis.log | grep "ECHO:" | sed 's/ECHO: /- /' >> STRUCTURAL_ANALYSIS_LOG.md
166+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
167+
fi
168+
169+
# Cross Beam
170+
if grep -q "Cross Beam.*FAIL" structural_analysis.log; then
171+
echo "**3. Cross Beam Bending**" >> STRUCTURAL_ANALYSIS_LOG.md
172+
grep -A 5 "=== CROSS BEAM STRESS ANALYSIS ===" structural_analysis.log | grep "ECHO:" | sed 's/ECHO: /- /' >> STRUCTURAL_ANALYSIS_LOG.md
173+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
174+
fi
175+
176+
# Pivot Ring Welds
177+
if grep -q "Pivot Ring.*FAIL" structural_analysis.log; then
178+
echo "**4. Pivot Ring Welds**" >> STRUCTURAL_ANALYSIS_LOG.md
179+
grep -A 5 "=== PIVOT RING WELD ANALYSIS ===" structural_analysis.log | grep "ECHO:" | sed 's/ECHO: /- /' >> STRUCTURAL_ANALYSIS_LOG.md
180+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
181+
fi
182+
183+
echo "### Recommended Actions" >> STRUCTURAL_ANALYSIS_LOG.md
184+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
185+
echo "See [STRUCTURAL_ANALYSIS.md](STRUCTURAL_ANALYSIS.md) for design modification recommendations." >> STRUCTURAL_ANALYSIS_LOG.md
186+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
187+
else
188+
echo "### ✅ All Tests Passed" >> STRUCTURAL_ANALYSIS_LOG.md
189+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
190+
echo "All structural analysis checks passed successfully." >> STRUCTURAL_ANALYSIS_LOG.md
191+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
192+
fi
193+
else
194+
echo "### Error" >> STRUCTURAL_ANALYSIS_LOG.md
195+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
196+
echo "No structural analysis summary found in output. Check the workflow logs for errors." >> STRUCTURAL_ANALYSIS_LOG.md
197+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
198+
fi
199+
200+
echo "---" >> STRUCTURAL_ANALYSIS_LOG.md
201+
echo "" >> STRUCTURAL_ANALYSIS_LOG.md
202+
echo "_This file is automatically updated by the OpenSCAD Structural Analysis workflow._" >> STRUCTURAL_ANALYSIS_LOG.md
203+
204+
cat STRUCTURAL_ANALYSIS_LOG.md
205+
206+
- name: Commit structural analysis log
207+
run: |
208+
cd LifeTrac-v25/mechanical_design
209+
git config --global user.name 'github-actions[bot]'
210+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
211+
212+
# Add the log file
213+
git add STRUCTURAL_ANALYSIS_LOG.md
214+
215+
# Check if there are changes
216+
if ! git diff --staged --quiet; then
217+
git commit -m "Update structural analysis log [skip ci]"
218+
git push --force-with-lease origin HEAD || {
219+
echo "INFO: git push failed. This is expected on PRs from forks."
220+
echo "The log file is available as a workflow artifact."
221+
}
222+
else
223+
echo "No changes to structural analysis log"
224+
fi
225+
env:
226+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227+
112228
- name: Upload structural analysis artifacts
113229
uses: actions/upload-artifact@v4
114230
with:
115231
name: structural-analysis
116232
path: |
117233
LifeTrac-v25/mechanical_design/structural_analysis.log
118234
LifeTrac-v25/mechanical_design/structural_report.md
235+
LifeTrac-v25/mechanical_design/STRUCTURAL_ANALYSIS_LOG.md
119236
retention-days: 90
120237

121238
- name: Cleanup Xvfb
@@ -164,6 +281,10 @@ jobs:
164281
165282
${reportContent}
166283
284+
### Persistent Log
285+
A detailed log with failure descriptions has been committed to:
286+
- \`LifeTrac-v25/mechanical_design/STRUCTURAL_ANALYSIS_LOG.md\`
287+
167288
### Artifacts
168289
Download the detailed analysis from the workflow artifacts:
169290
- \`structural-analysis\` - Complete logs and report

0 commit comments

Comments
 (0)