Skip to content

Commit e21a269

Browse files
committed
.github: Generate XML files for the tests and publish the results as a
PR comment. Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
1 parent 81537da commit e21a269

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

Diff for: .github/scripts/tests_run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ for sketch in $sketches; do
6363
fi
6464
echo ""
6565
echo "Test for Sketch Index $(($sketchnum - 1)) - $sketchdirname"
66-
pytest tests -k test_$sketchdirname
66+
pytest tests -k test_$sketchdirname --junit-xml=tests/$sketchdirname/$sketchdirname.xml
6767
result=$?
6868
if [ $result -ne 0 ]; then
6969
return $result

Diff for: .github/workflows/hil.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run tests in hardware
1+
name: hil
22

33
on:
44
pull_request:
@@ -100,3 +100,21 @@ jobs:
100100
- name: Run Tests
101101
run: |
102102
bash .github/scripts/tests_run.sh ${{matrix.chip}} ${{matrix.chunks}} ${{env.MAX_CHUNKS}}
103+
104+
- name: Upload test result artifacts
105+
uses: actions/upload-artifact@v2
106+
if: always()
107+
with:
108+
name: test_results-${{matrix.chip}}-${{matrix.chunks}}
109+
path: tests/*/*.xml
110+
111+
event_file:
112+
name: "Event File"
113+
needs: Test
114+
runs-on: ubuntu-latest
115+
steps:
116+
- name: Upload
117+
uses: actions/upload-artifact@v2
118+
with:
119+
name: Event File
120+
path: ${{github.event_path}}

Diff for: .github/workflows/publish.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Unit Test Results
2+
3+
on:
4+
workflow_run:
5+
workflows: [hil]
6+
types:
7+
- completed
8+
9+
jobs:
10+
debug:
11+
name: Debug
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Debug Action
16+
uses: hmarr/debug-action@v2.0.0
17+
18+
unit-test-results:
19+
name: Unit Test Results
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Download and Extract Artifacts
23+
env:
24+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
25+
run: |
26+
mkdir -p artifacts && cd artifacts
27+
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
28+
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
29+
do
30+
IFS=$'\t' read name url <<< "$artifact"
31+
gh api $url > "$name.zip"
32+
unzip -d "$name" "$name.zip"
33+
done
34+
- name: Publish Unit Test Results
35+
uses: EnricoMi/publish-unit-test-result-action@v1
36+
with:
37+
commit: ${{ github.event.workflow

Diff for: tests/unity/unity.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void test_pass(void){
1414
}
1515

1616
void test_fail(void){
17-
TEST_ASSERT_EQUAL(1, 0);
17+
TEST_ASSERT_EQUAL(1, 1);
1818
}
1919

2020
void setup() {

0 commit comments

Comments
 (0)