Skip to content

Commit 5d054a4

Browse files
committed
Run diagnostic tests for STM32 on azure as well
Signed-off-by: Liviu Tomoiaga <Liviu.Tomoiaga@analog.com>
1 parent 463830e commit 5d054a4

2 files changed

Lines changed: 615 additions & 0 deletions

File tree

build_projects.yml

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
trigger:
2+
branches:
3+
include:
4+
- main
5+
- next_stable
6+
- 20*
7+
pr:
8+
branches:
9+
include:
10+
- main
11+
- next_stable
12+
- 20*
13+
paths:
14+
exclude:
15+
- doc/**
16+
- '**/*.md'
17+
- '**/*.rst'
18+
variables:
19+
- group: noos_releases_group_variables
20+
- name: isMain
21+
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
22+
- name: isNextStable
23+
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/next_stable')]
24+
- name: isRelease
25+
value: $[contains(variables['Build.SourceBranch'], 'refs/heads/20')]
26+
- name: branch
27+
value: $(Build.SourceBranchName)
28+
stages:
29+
- stage: __default
30+
jobs:
31+
- job: STM32
32+
timeoutInMinutes: 200
33+
pool:
34+
name: Default
35+
demands:
36+
- agent.name -equals no-OS
37+
steps:
38+
- task: 6d15af64-176c-496d-b583-fd2ae21d4df4@1
39+
inputs:
40+
repository: self
41+
fetchDepth: 50
42+
submodules: true
43+
clean: true
44+
persistCredentials: true
45+
- task: CmdLine@2
46+
displayName: 'Show SDK versions'
47+
inputs:
48+
script: |
49+
[ -f /no-OS_agent/.stm32_environment.sh ] && . /no-OS_agent/.stm32_environment.sh
50+
STM32CUBEIDE="${STM32CUBEIDE:-/opt/stm32cubeide}"
51+
STM32CUBEMX="${STM32CUBEMX:-/opt/stm32cubemx}"
52+
53+
echo "STM32CubeIDE path: $STM32CUBEIDE"
54+
echo "STM32CubeMX path: $STM32CUBEMX"
55+
56+
# CubeIDE version from its product descriptor.
57+
IDE_VER=$(sed -n 's/^version=//p' "$STM32CUBEIDE/.eclipseproduct" 2>/dev/null)
58+
echo "Using STM32CubeIDE version: ${IDE_VER:-unknown}"
59+
60+
# CubeMX version
61+
MX_VER=$(strings "$STM32CUBEMX/.installationinformation" 2>/dev/null \
62+
| grep -A1 'APP_VER' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
63+
echo "Using STM32CubeMX version: ${MX_VER:-unknown}"
64+
65+
# arm-none-eabi-gcc version
66+
GCC=$(find "$STM32CUBEIDE/plugins" -name arm-none-eabi-gcc -path '*gnu-tools*' 2>/dev/null | head -1)
67+
echo "Bundled toolchain: ${GCC:-not found}"
68+
[ -n "$GCC" ] && "$GCC" -dumpfullversion 2>/dev/null | sed 's/^/Bundled arm-none-eabi-gcc version: /'
69+
- task: CmdLine@2
70+
displayName: '[DEBUG] Pre-build diagnostics'
71+
inputs:
72+
script: |
73+
echo "=== AGENT / ENV INFO ==="
74+
echo "Hostname: $(hostname)"
75+
echo "Agent name: $(Agent.MachineName)"
76+
echo "CPU cores: $(nproc)"
77+
free -h
78+
df -h /no-OS_builds || true
79+
80+
echo ""
81+
echo "=== BUILDS_DIR STATE ==="
82+
echo "Contents of /no-OS_builds/builds (top 2 levels):"
83+
find /no-OS_builds/builds -maxdepth 2 -type d 2>/dev/null | head -60 || echo "(empty or missing)"
84+
echo ""
85+
echo "Total size of /no-OS_builds/builds:"
86+
du -sh /no-OS_builds/builds 2>/dev/null || echo "(missing)"
87+
echo ""
88+
echo "File count in /no-OS_builds/builds:"
89+
find /no-OS_builds/builds -type f 2>/dev/null | wc -l
90+
91+
echo ""
92+
echo "=== DEPS CACHE STATE ==="
93+
echo "Contents of /no-OS_builds/deps_cache (top 2 levels):"
94+
find /no-OS_builds/deps_cache -maxdepth 2 -type d 2>/dev/null | head -60 || echo "(empty or missing)"
95+
echo ""
96+
echo "Total size of /no-OS_builds/deps_cache:"
97+
du -sh /no-OS_builds/deps_cache 2>/dev/null || echo "(missing)"
98+
99+
echo ""
100+
echo "=== STM32 PROJECTS TO BUILD ==="
101+
find $(Build.Repository.LocalPath)/projects -type f -name '*.ioc' -path '*stm32*' 2>/dev/null | sort || true
102+
find $(Build.Repository.LocalPath)/projects -type f -name 'Makefile' -path '*stm32*' 2>/dev/null | sort || true
103+
echo ""
104+
echo "=== WORKSPACE CLEAN STATE ==="
105+
echo "Source dir size:"
106+
du -sh $(Build.Repository.LocalPath) 2>/dev/null || true
107+
108+
echo ""
109+
echo "=== TIMESTAMP START ==="
110+
date -u +"%Y-%m-%dT%H:%M:%SZ"
111+
- task: CmdLine@2
112+
env:
113+
CLOUDSMITH_API_KEY: $(CLOUDSMITH_API_KEY)
114+
TOKEN: $(TOKEN)
115+
NO_OS_CACHE_DIR: /no-OS_builds/deps_cache
116+
displayName: 'Run project build'
117+
inputs:
118+
script: |
119+
BUILD_START=$(date +%s)
120+
121+
wget -P ./tools/scripts/ \
122+
https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/refs/heads/main/utils/cloudsmith_utils/cloudsmith_helper.py && \
123+
python3 ./tools/scripts/build_projects.py $(Build.Repository.LocalPath) \
124+
-export_dir $(RELEASE_DIR) \
125+
-log_dir $(LOG_DIR) \
126+
-builds_dir /no-OS_builds/builds \
127+
-platform stm32 \
128+
-hdl_branch $(HDL_BRANCH)
129+
BUILD_RC=$?
130+
131+
BUILD_END=$(date +%s)
132+
TOTAL_SEC=$((BUILD_END - BUILD_START))
133+
echo ""
134+
echo "=== [DEBUG] BUILD TIMING ==="
135+
echo "Total build step duration: ${TOTAL_SEC}s ($(($TOTAL_SEC / 60))m $(($TOTAL_SEC % 60))s)"
136+
137+
# Per-project timing from log files
138+
LOG_BASE="$(Build.Repository.LocalPath)/$(LOG_DIR)"
139+
COUNT=0
140+
SUM=0
141+
echo ""
142+
echo "=== [DEBUG] PER-PROJECT TIMING ==="
143+
for log in $(find "$LOG_BASE" -type f -name '*.log' 2>/dev/null | sort); do
144+
PROJECT=$(basename "$log" .log)
145+
# Extract elapsed/duration lines the build script may have printed
146+
ELAPSED=$(grep -iE 'elapsed|duration|time|took' "$log" 2>/dev/null | tail -1)
147+
# Fallback: measure from file timestamps (creation vs last modification)
148+
MOD_TIME=$(stat -c %Y "$log" 2>/dev/null || echo 0)
149+
BIRTH_TIME=$(stat -c %W "$log" 2>/dev/null || echo 0)
150+
if [ "$BIRTH_TIME" != "0" ] && [ "$BIRTH_TIME" != "-" ] && [ "$MOD_TIME" != "0" ]; then
151+
FILE_DUR=$((MOD_TIME - BIRTH_TIME))
152+
else
153+
FILE_DUR=-1
154+
fi
155+
echo " $PROJECT: file_duration=${FILE_DUR}s log_line=\"${ELAPSED:-n/a}\""
156+
if [ "$FILE_DUR" -ge 0 ] 2>/dev/null; then
157+
SUM=$((SUM + FILE_DUR))
158+
COUNT=$((COUNT + 1))
159+
fi
160+
done
161+
echo ""
162+
if [ "$COUNT" -gt 0 ]; then
163+
AVG=$((SUM / COUNT))
164+
echo "Projects with timing: $COUNT"
165+
echo "Sum of per-project durations: ${SUM}s"
166+
echo "Average per-project build time: ${AVG}s ($(($AVG / 60))m $(($AVG % 60))s)"
167+
else
168+
echo "No per-project timing data available from logs."
169+
fi
170+
171+
exit $BUILD_RC
172+
- task: CmdLine@2
173+
displayName: '[DEBUG] Post-build diagnostics'
174+
condition: always()
175+
inputs:
176+
script: |
177+
echo "=== TIMESTAMP END ==="
178+
date -u +"%Y-%m-%dT%H:%M:%SZ"
179+
180+
echo ""
181+
echo "=== BUILDS_DIR AFTER BUILD ==="
182+
echo "Total size of /no-OS_builds/builds:"
183+
du -sh /no-OS_builds/builds 2>/dev/null || echo "(missing)"
184+
echo ""
185+
echo "File count in /no-OS_builds/builds:"
186+
find /no-OS_builds/builds -type f 2>/dev/null | wc -l
187+
echo ""
188+
echo "Recently modified files (last 10 min):"
189+
find /no-OS_builds/builds -type f -mmin -10 2>/dev/null | head -40
190+
191+
echo ""
192+
echo "=== EXPORT_DIR CONTENTS ==="
193+
echo "Contents of $(RELEASE_DIR):"
194+
find $(Build.Repository.LocalPath)/$(RELEASE_DIR) -type f 2>/dev/null | head -40 || echo "(empty or missing)"
195+
196+
echo ""
197+
echo "=== LOG_DIR CONTENTS ==="
198+
echo "Contents of $(LOG_DIR):"
199+
find $(Build.Repository.LocalPath)/$(LOG_DIR) -type f 2>/dev/null | head -40 || echo "(empty or missing)"
200+
echo ""
201+
echo "Build log snippets (last 30 lines of each log):"
202+
for log in $(find $(Build.Repository.LocalPath)/$(LOG_DIR) -type f -name '*.log' 2>/dev/null | head -10); do
203+
echo "--- $log ---"
204+
tail -30 "$log"
205+
echo ""
206+
done
207+
208+
echo ""
209+
echo "=== DEPS CACHE AFTER BUILD ==="
210+
du -sh /no-OS_builds/deps_cache 2>/dev/null || echo "(missing)"
211+
- task: PublishPipelineArtifact@1
212+
timeoutInMinutes: 10
213+
condition: or(eq(variables.isMain, true), eq(variables.isNextStable, true), eq(variables.isRelease, true))
214+
inputs:
215+
targetPath: '$(Build.Repository.LocalPath)/$(RELEASE_DIR)'
216+
artifact: '$(ARTIFACT_NAME)_STM32'
217+
publishLocation: 'pipeline'
218+
- task: PublishPipelineArtifact@1
219+
condition: true
220+
inputs:
221+
targetPath: '$(Build.Repository.LocalPath)/$(LOG_DIR)'
222+
artifact: 'logs_STM32_$(System.JobId)'
223+
publishLocation: 'pipeline'
224+
- job: ADuCM3029
225+
timeoutInMinutes: 200
226+
pool:
227+
name: Default
228+
demands:
229+
- agent.name -equals no-OS
230+
steps:
231+
- task: 6d15af64-176c-496d-b583-fd2ae21d4df4@1
232+
inputs:
233+
repository: self
234+
fetchDepth: 50
235+
submodules: true
236+
clean: true
237+
persistCredentials: true
238+
- task: CmdLine@2
239+
displayName: 'Show SDK versions'
240+
inputs:
241+
script: |
242+
echo "Using ADuCM3029 DFP version: $(ADUCM3029_DFP_VERSION)"
243+
echo "Using CCES IDE version: $(CCES_VERSION)"
244+
echo "Using ARM CMSIS version: $(ARM_CMSIS_VERSION)"
245+
- task: CmdLine@2
246+
env:
247+
CLOUDSMITH_API_KEY: $(CLOUDSMITH_API_KEY)
248+
TOKEN: $(TOKEN)
249+
NO_OS_CACHE_DIR: /no-OS_builds/deps_cache
250+
displayName: 'Run project build'
251+
inputs:
252+
script: |
253+
wget -P ./tools/scripts/ \
254+
https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/refs/heads/main/utils/cloudsmith_utils/cloudsmith_helper.py && \
255+
python3 ./tools/scripts/build_projects.py $(Build.Repository.LocalPath) \
256+
-export_dir $(RELEASE_DIR) \
257+
-log_dir $(LOG_DIR) \
258+
-builds_dir /no-OS_builds/builds \
259+
-platform aducm3029 \
260+
-hdl_branch $(HDL_BRANCH)
261+
- task: PublishPipelineArtifact@1
262+
timeoutInMinutes: 10
263+
condition: or(eq(variables.isMain, true), eq(variables.isNextStable, true), eq(variables.isRelease, true))
264+
inputs:
265+
targetPath: '$(Build.Repository.LocalPath)/$(RELEASE_DIR)'
266+
artifact: '$(ARTIFACT_NAME)_ADuCM3029'
267+
publishLocation: 'pipeline'
268+
- task: PublishPipelineArtifact@1
269+
condition: true
270+
inputs:
271+
targetPath: '$(Build.Repository.LocalPath)/$(LOG_DIR)'
272+
artifact: 'logs_ADuCM3029_$(System.JobId)'
273+
publishLocation: 'pipeline'

0 commit comments

Comments
 (0)