Skip to content

Commit f4338a3

Browse files
committed
Test Build Data collection
1 parent d5c5b1a commit f4338a3

File tree

2 files changed

+194
-11
lines changed

2 files changed

+194
-11
lines changed

.github/workflows/CubeMX-CI.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,143 @@ on:
1717
jobs:
1818
Build:
1919
runs-on: ubuntu-latest
20+
outputs:
21+
build_status: ${{ steps.build_step.outcome }}
22+
build_timestamp: ${{ steps.set_timestamp.outputs.timestamp }}
2023

2124
steps:
2225
- name: Checkout repo
2326
uses: actions/checkout@v4
2427

28+
- name: Set timestamp
29+
id: set_timestamp
30+
run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
31+
2532
- name: Install tools
33+
id: install_tools
2634
uses: ARM-software/cmsis-actions/vcpkg@v1
2735
with:
2836
config: ".ci/vcpkg-configuration.json"
37+
continue-on-error: false
38+
39+
- name: Save tool installation logs
40+
if: always()
41+
run: |
42+
mkdir -p logs
43+
echo "=== Tool Installation Information ===" > logs/install_tools.log
44+
echo "Timestamp: $(date -u +"%Y-%m-%d %H:%M:%S")" >> logs/install_tools.log
45+
echo "" >> logs/install_tools.log
46+
47+
# Check if cbuild is available and get its version
48+
if command -v cbuild &> /dev/null; then
49+
echo "=== CMSIS Toolbox Version ===" >> logs/install_tools.log
50+
cbuild --version 2>&1 >> logs/install_tools.log || echo "Version unavailable" >> logs/install_tools.log
51+
else
52+
echo "cbuild command not found" >> logs/install_tools.log
53+
fi
54+
55+
- name: Upload tool logs
56+
if: always()
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: tool-logs
60+
path: logs/
2961

3062
- name: Activate Arm tool license
3163
uses: ARM-software/cmsis-actions/armlm@v1
3264

3365
- name: Build project with AC6
66+
id: build_step
3467
working-directory: ./CubeMX/
3568
run: cbuild CubeMX.csolution.yml --packs --toolchain AC6 --rebuild
69+
70+
CollectData:
71+
runs-on: ubuntu-latest
72+
needs: Build
73+
if: always()
74+
steps:
75+
- name: Download tool logs
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: tool-logs
79+
path: logs/
80+
81+
- name: Parse and collect data
82+
run: |
83+
# Parse tool installation log
84+
if [ -f logs/install_tools.log ]; then
85+
echo "Parsing tool installation log..."
86+
cat logs/install_tools.log
87+
else
88+
echo "No tool installation log found"
89+
fi
90+
91+
- name: Generate JSON report
92+
run: |
93+
cat << 'EOF' > collect_data.py
94+
import json
95+
import re
96+
from datetime import datetime
97+
98+
def parse_tool_log(log_path):
99+
cmsis_toolbox_info = None
100+
try:
101+
with open(log_path, 'r') as f:
102+
content = f.read()
103+
104+
# Parse cbuild --version output
105+
# Looking for version number like "2.12.0" or similar
106+
match = re.search(r'=== CMSIS Toolbox Version ===\s*(.+?)(?:\n|$)', content)
107+
if match:
108+
version = match.group(1).strip()
109+
cmsis_toolbox_info = {
110+
"version": version,
111+
"tool": "cmsis-toolbox"
112+
}
113+
114+
except FileNotFoundError:
115+
print("Tool log file not found")
116+
except Exception as e:
117+
print(f"Error parsing tool log: {e}")
118+
119+
return cmsis_toolbox_info
120+
121+
# Collect data
122+
data = {
123+
"workflow": "CubeMX: Test Build",
124+
"build_job": {
125+
"last_run": "${{ needs.Build.outputs.build_timestamp }}",
126+
"status": "${{ needs.Build.outputs.build_status }}",
127+
"passed": "${{ needs.Build.outputs.build_status }}" == "success"
128+
},
129+
"cmsis_toolbox": parse_tool_log("logs/install_tools.log"),
130+
"metadata": {
131+
"run_id": "${{ github.run_id }}",
132+
"run_number": "${{ github.run_number }}",
133+
"workflow_ref": "${{ github.workflow_ref }}",
134+
"event": "${{ github.event_name }}",
135+
"branch": "${{ github.ref_name }}",
136+
"commit": "${{ github.sha }}"
137+
}
138+
}
139+
140+
# Print JSON
141+
print(json.dumps(data, indent=2))
142+
143+
# Save to file
144+
with open('workflow_data.json', 'w') as f:
145+
json.dump(data, f, indent=2)
146+
EOF
147+
148+
python3 collect_data.py
149+
150+
- name: Display collected data
151+
run: |
152+
echo "=== Workflow Data Collection ==="
153+
cat workflow_data.json
154+
155+
- name: Upload workflow data
156+
uses: actions/upload-artifact@v4
157+
with:
158+
name: workflow-data
159+
path: workflow_data.json

.vscode/launch.json

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,89 @@
66
"type": "arm-debugger",
77
"request": "launch",
88
"programs": [
9-
"${workspaceFolder}/SimpleTrustZone/out/CM33_ns/CS300/Debug/CM33_ns.axf",
10-
"${workspaceFolder}/SimpleTrustZone/out/CM33_s/CS300/Debug/CM33_s.axf"
9+
"${workspaceFolder}/SimpleTrustZone/out/CM33_ns/CS300/Debug/CM33_ns.axf",
10+
"${workspaceFolder}/SimpleTrustZone/out/CM33_s/CS300/Debug/CM33_s.axf"
1111
],
1212
"programMode": "ram",
13-
// armdbg --cdb-list
1413
"cdbEntry": "Arm FVP::MPS2_Cortex_M33::Bare Metal Debug::Bare Metal Debug::Cortex-M33_0",
15-
"cdbEntryParams": {
16-
"model_params": "-f ${workspaceFolder}/SimpleTrustZone/model_config.txt"
14+
"cdbEntryParams": {
15+
"model_params": "-f ${workspaceFolder}/SimpleTrustZone/model_config.txt"
1716
}
1817
},
1918
{
2019
"name": "SimpleTZ (GCC/Clang)",
2120
"type": "arm-debugger",
2221
"request": "launch",
2322
"programs": [
24-
"${workspaceFolder}/SimpleTrustZone/out/CM33_ns/CS300/Debug/CM33_ns.elf",
25-
"${workspaceFolder}/SimpleTrustZone/out/CM33_s/CS300/Debug/CM33_s.elf"
23+
"${workspaceFolder}/SimpleTrustZone/out/CM33_ns/CS300/Debug/CM33_ns.elf",
24+
"${workspaceFolder}/SimpleTrustZone/out/CM33_s/CS300/Debug/CM33_s.elf"
2625
],
2726
"programMode": "ram",
28-
// armdbg --cdb-list
2927
"cdbEntry": "Arm FVP::MPS2_Cortex_M33::Bare Metal Debug::Bare Metal Debug::Cortex-M33_0",
30-
"cdbEntryParams": {
31-
"model_params": "-f ${workspaceFolder}/SimpleTrustZone/model_config.txt"
28+
"cdbEntryParams": {
29+
"model_params": "-f ${workspaceFolder}/SimpleTrustZone/model_config.txt"
30+
}
31+
},
32+
{
33+
"name": "STLink@pyOCD (launch)",
34+
"type": "gdbtarget",
35+
"request": "launch",
36+
"cwd": "${workspaceFolder}/CubeMX",
37+
"program": "out\\CubeMX\\MyBoard_ROM\\Debug\\CubeMX.axf",
38+
"gdb": "arm-none-eabi-gdb",
39+
"preLaunchTask": "CMSIS Load",
40+
"initCommands": [
41+
"monitor reset halt",
42+
"tbreak main"
43+
],
44+
"customResetCommands": [
45+
"monitor reset halt",
46+
"tbreak main",
47+
"continue"
48+
],
49+
"target": {
50+
"server": "pyocd",
51+
"serverParameters": [
52+
"gdbserver",
53+
"--probe",
54+
"stlink:",
55+
"--connect",
56+
"attach",
57+
"--cbuild-run",
58+
"${command:cmsis-csolution.getCbuildRunFile}",
59+
"--quiet",
60+
"--log",
61+
"*.cbuild_run,*server=info"
62+
],
63+
"port": "3333"
64+
},
65+
"cmsis": {
66+
"cbuildRunFile": "${command:cmsis-csolution.getCbuildRunFile}",
67+
"updateConfiguration": "auto"
68+
}
69+
},
70+
{
71+
"name": "STLink@pyOCD (attach)",
72+
"type": "gdbtarget",
73+
"request": "attach",
74+
"cwd": "${workspaceFolder}/CubeMX",
75+
"program": "out\\CubeMX\\MyBoard_ROM\\Debug\\CubeMX.axf",
76+
"gdb": "arm-none-eabi-gdb",
77+
"initCommands": [
78+
""
79+
],
80+
"customResetCommands": [
81+
"monitor reset halt",
82+
"tbreak main",
83+
"continue"
84+
],
85+
"target": {
86+
"port": "3333"
87+
},
88+
"cmsis": {
89+
"cbuildRunFile": "${command:cmsis-csolution.getCbuildRunFile}",
90+
"updateConfiguration": "auto"
3291
}
3392
}
3493
]
35-
}
94+
}

0 commit comments

Comments
 (0)