Skip to content

Commit 8c2a667

Browse files
committed
publish step
Signed-off-by: Anas Nashif <[email protected]>
1 parent 78a6734 commit 8c2a667

File tree

2 files changed

+76
-63
lines changed

2 files changed

+76
-63
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Twister Test Results
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Run tests with twister"]
6+
branches:
7+
- main
8+
- topic/ci/upload_results
9+
- v*
10+
types:
11+
- completed
12+
13+
jobs:
14+
twister-test-results:
15+
name: "Publish Unit Tests Results"
16+
env:
17+
ELASTICSEARCH_KEY: ${{ secrets.ELASTICSEARCH_KEY }}
18+
ELASTICSEARCH_SERVER: "https://elasticsearch.zephyrproject.io:443"
19+
runs-on: ubuntu-22.04
20+
# the build-and-test job might be skipped, we don't need to run this job then
21+
if: success() || failure()
22+
23+
steps:
24+
# Needed for elasticearch and upload script
25+
- if: github.event_name == 'push' || github.event_name == 'schedule'
26+
name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
persist-credentials: false
31+
32+
- name: Download Artifacts
33+
uses: actions/download-artifact@v4
34+
with:
35+
path: artifacts
36+
37+
- if: github.event_name == 'push' || github.event_name == 'schedule'
38+
name: Upload to elasticsearch
39+
run: |
40+
pip3 install elasticsearch
41+
# set run date on upload to get consistent and unified data across the matrix.
42+
run_date=`date --iso-8601=minutes`
43+
if [ "${{github.event_name}}" = "push" ]; then
44+
python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \
45+
--run-attempt ${{github.run_attempt}} \
46+
--index zephyr-main-ci-push-1 artifacts/*/*/twister.json
47+
elif [ "${{github.event_name}}" = "schedule" ]; then
48+
python3 ./scripts/ci/upload_test_results_es.py -r ${run_date} \
49+
--run-attempt ${{github.run_attempt}} \
50+
--index zephyr-main-ci-weekly-1 artifacts/*/*/twister.json
51+
fi
52+
53+
- name: Merge Test Results
54+
run: |
55+
pip3 install junitparser junit2html
56+
junitparser merge artifacts/*/*/twister.xml junit.xml
57+
junit2html junit.xml junit.html
58+
59+
- name: Upload Unit Test Results in HTML
60+
if: always()
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: HTML Unit Test Results
64+
if-no-files-found: ignore
65+
path: |
66+
junit.html
67+
68+
- name: Publish Unit Test Results
69+
uses: EnricoMi/publish-unit-test-result-action@v2
70+
with:
71+
check_name: Unit Test Results
72+
files: "**/twister.xml"
73+
comment_mode: off

.github/workflows/twister.yaml

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
rundate: ${{ steps.output-services.outputs.rundate }}
3232
env:
3333
MATRIX_SIZE: 10
34-
PUSH_MATRIX_SIZE: 5
34+
PUSH_MATRIX_SIZE: 1
3535
DAILY_MATRIX_SIZE: 80
3636
BSIM_OUT_PATH: /opt/bsim/
3737
BSIM_COMPONENTS_PATH: /opt/bsim/components
@@ -234,10 +234,11 @@ jobs:
234234
name: Run Tests with Twister (Push)
235235
id: run_twister
236236
run: |
237+
237238
export ZEPHYR_BASE=${PWD}
238239
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
239240
./scripts/twister -T tests/kernel/threads -p qemu_x86 --subset ${{matrix.subset}}/${{ strategy.job-total }} ${TWISTER_COMMON} ${PUSH_OPTIONS}
240-
if [ "${{matrix.subset}}" = "1" ]; then
241+
if [ "${{matrix.subset}}" = "11" ]; then
241242
./scripts/zephyr_module.py --twister-out module_tests.args
242243
if [ -s module_tests.args ]; then
243244
./scripts/twister +module_tests.args --outdir module_tests ${TWISTER_COMMON} ${PUSH_OPTIONS}
@@ -311,67 +312,6 @@ jobs:
311312
path: |
312313
frozen-requirements.txt
313314
314-
twister-test-results:
315-
name: "Publish Unit Tests Results"
316-
env:
317-
ELASTICSEARCH_KEY: ${{ secrets.ELASTICSEARCH_KEY }}
318-
ELASTICSEARCH_SERVER: "https://elasticsearch.zephyrproject.io:443"
319-
needs:
320-
- twister-build
321-
runs-on: ubuntu-22.04
322-
# the build-and-test job might be skipped, we don't need to run this job then
323-
if: success() || failure()
324-
325-
steps:
326-
# Needed for elasticearch and upload script
327-
- if: github.event_name == 'push' || github.event_name == 'schedule'
328-
name: Checkout
329-
uses: actions/checkout@v4
330-
with:
331-
fetch-depth: 0
332-
persist-credentials: false
333-
334-
- name: Download Artifacts
335-
uses: actions/download-artifact@v4
336-
with:
337-
path: artifacts
338-
339-
- if: github.event_name == 'push' || github.event_name == 'schedule'
340-
name: Upload to elasticsearch
341-
run: |
342-
pip3 install elasticsearch
343-
# set run date on upload to get consistent and unified data across the matrix.
344-
if [ "${{github.event_name}}" = "push" ]; then
345-
python3 ./scripts/ci/upload_test_results_es.py -r ${{needs.twister-build.outputs.rundate}} \
346-
--run-attempt ${{github.run_attempt}} \
347-
--index zephyr-main-ci-push-1 artifacts/*/*/twister.json
348-
elif [ "${{github.event_name}}" = "schedule" ]; then
349-
python3 ./scripts/ci/upload_test_results_es.py -r ${{needs.twister-build.outputs.rundate}} \
350-
--run-attempt ${{github.run_attempt}} \
351-
--index zephyr-main-ci-weekly-1 artifacts/*/*/twister.json
352-
fi
353-
354-
- name: Merge Test Results
355-
run: |
356-
pip3 install junitparser junit2html
357-
junitparser merge artifacts/*/*/twister.xml junit.xml
358-
junit2html junit.xml junit.html
359-
360-
- name: Upload Unit Test Results in HTML
361-
if: always()
362-
uses: actions/upload-artifact@v4
363-
with:
364-
name: HTML Unit Test Results
365-
if-no-files-found: ignore
366-
path: |
367-
junit.html
368-
369-
- name: Publish Unit Test Results
370-
uses: EnricoMi/publish-unit-test-result-action@v2
371-
with:
372-
check_name: Unit Test Results
373-
files: "**/twister.xml"
374-
comment_mode: off
375315
twister-status-check:
376316
if: always()
377317
name: "Check Twister Status"

0 commit comments

Comments
 (0)