Skip to content

Commit 6ccad3c

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

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Twister Test Results
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Run tests with twister"]
6+
branches:
7+
- main
8+
- v*
9+
types:
10+
- completed
11+
12+
jobs:
13+
twister-test-results:
14+
name: "Publish Unit Tests Results"
15+
env:
16+
ELASTICSEARCH_KEY: ${{ secrets.ELASTICSEARCH_KEY }}
17+
ELASTICSEARCH_SERVER: "https://elasticsearch.zephyrproject.io:443"
18+
needs:
19+
- twister-build
20+
runs-on: ubuntu-22.04
21+
# the build-and-test job might be skipped, we don't need to run this job then
22+
if: success() || failure()
23+
24+
steps:
25+
# Needed for elasticearch and upload script
26+
- if: github.event_name == 'push' || github.event_name == 'schedule'
27+
name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
persist-credentials: false
32+
33+
- name: Download Artifacts
34+
uses: actions/download-artifact@v4
35+
with:
36+
path: artifacts
37+
38+
- if: github.event_name == 'push' || github.event_name == 'schedule'
39+
name: Upload to elasticsearch
40+
run: |
41+
pip3 install elasticsearch
42+
# set run date on upload to get consistent and unified data across the matrix.
43+
if [ "${{github.event_name}}" = "push" ]; then
44+
python3 ./scripts/ci/upload_test_results_es.py -r ${{needs.twister-build.outputs.rundate}} \
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 ${{needs.twister-build.outputs.rundate}} \
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
74+
twister-status-check:
75+
if: always()
76+
name: "Check Twister Status"
77+
needs:
78+
- twister-build-prep
79+
- twister-build
80+
uses: ./.github/workflows/ready-to-merge.yml
81+
with:
82+
needs_context: ${{ toJson(needs) }}

0 commit comments

Comments
 (0)