18
18
upload_artifacts :
19
19
type : boolean
20
20
required : true
21
+ run_executable :
22
+ type : boolean
23
+ required : true
24
+ run_coverage :
25
+ type : boolean
26
+ required : true
21
27
pre_run_script :
22
28
type : string
23
29
required : false
@@ -51,14 +57,24 @@ jobs:
51
57
# The sdkconfig.ci.linux specifies Linux as the build target with apropriate settings.
52
58
cp sdkconfig.ci.linux sdkconfig.defaults
53
59
idf.py build
54
- ./build/${{inputs.app_name}}.elf -r junit -o junit.xml
60
+ if [ "${{ inputs.run_executable}}" == "false" ]; then
61
+ echo "Executeable wasn't run"
62
+ exit 0
63
+ fi
64
+
65
+ if [ "${{ inputs.publish_unit_test_result }}" == "true" ]; then
66
+ ./build/${{inputs.app_name}}.elf --reporter JUnit::out=result-junit.xml --reporter console::out=-::colour-mode=ansi
67
+ else
68
+ ./build/${{inputs.app_name}}.elf
69
+ fi
55
70
- name : Publish Unit Test Result
56
71
uses : EnricoMi/publish-unit-test-result-action@v2
57
72
if : ${{ inputs.publish_unit_test_result }}
58
73
with :
59
74
files : ${{inputs.component_path}}/**/*junit.xml
60
75
- name : Build with Coverage Enabled
61
76
shell : bash
77
+ if : ${{ inputs.run_coverage }}
62
78
run : |
63
79
component=$(basename ${{ inputs.component_path }})
64
80
if [ -f "${{ inputs.pre_run_script }}" ]; then
74
90
./build/${{inputs.app_name}}.elf
75
91
- name : Run Coverage
76
92
shell : bash
93
+ if : ${{ inputs.run_coverage }}
77
94
run : |
78
95
apt-get update && apt-get install -y python3-pip rsync
79
96
python -m pip install gcovr
86
103
cp index.html ${{inputs.app_name}}_coverage_report
87
104
cp -rf ${{inputs.app_name}}_coverage_report ${{inputs.app_name}}_coverage.xml $GITHUB_WORKSPACE
88
105
- name : Code Coverage Summary Report
106
+ if : ${{ inputs.run_coverage }}
89
107
uses : irongut/CodeCoverageSummary@v1.3.0
90
108
with :
91
109
filename : esp-protocols/**/${{inputs.app_name}}_coverage.xml
@@ -99,9 +117,10 @@ jobs:
99
117
thresholds : ' 60 80'
100
118
- name : Write to Job Summary
101
119
run : cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
120
+ if : ${{ inputs.run_coverage }}
102
121
- name : Upload files to artifacts for run-target job
103
122
uses : actions/upload-artifact@v3
104
- if : ${{inputs.upload_artifacts }}
123
+ if : ${{ inputs.run_coverage }}
105
124
with :
106
125
name : ${{inputs.app_name}}_coverage_report
107
126
path : |
0 commit comments