Skip to content

Commit d3253a1

Browse files
committed
ci: twister: fix steps for analyzing failures
Checkout code early, so files are downloaded and read from one single place. Check for job results, only run script on failures. Signed-off-by: Anas Nashif <[email protected]>
1 parent f3bdd2b commit d3253a1

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

.github/workflows/twister.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ jobs:
217217
if: success() || failure()
218218

219219
steps:
220+
- name: Check out source code
221+
if: needs.twister-build.result == 'failure'
222+
uses: actions/checkout@v4
223+
with:
224+
ref: ${{ github.event.pull_request.head.sha }}
225+
fetch-depth: 0
226+
persist-credentials: false
227+
220228
- name: Download Artifacts
221229
uses: actions/download-artifact@v4
222230
with:
@@ -244,23 +252,17 @@ jobs:
244252
files: "**/twister.xml"
245253
comment_mode: off
246254

247-
- name: Check out source code
248-
if: failure()
249-
uses: actions/checkout@v4
250-
with:
251-
ref: ${{ github.event.pull_request.head.sha }}
252-
fetch-depth: 0
253-
persist-credentials: false
254-
255255
- name: Analyze Twister Reports
256-
if: failure()
256+
if: needs.twister-build.result == 'failure'
257257
run: |
258258
./scripts/ci/twister_report_analyzer.py artifacts/*/*/twister.json --long-summary --platforms --output-md errors.md
259-
echo '### Error Summary! 🚀' >> $GITHUB_STEP_SUMMARY
260-
cat errors.md >> $GITHUB_STEP_SUMMARY
259+
if [[ -s "errors.md" ]]; then
260+
echo '### Error Summary! 🚀' >> $GITHUB_STEP_SUMMARY
261+
cat errors.md >> $GITHUB_STEP_SUMMARY
262+
fi
261263
262264
- name: Upload Twister Analysis Results
263-
if: failure()
265+
if: needs.twister-build.result == 'failure'
264266
uses: actions/upload-artifact@v4
265267
with:
266268
name: Twister Analysis Results

0 commit comments

Comments
 (0)