@@ -18,11 +18,14 @@ jobs:
18
18
gen_chunks :
19
19
if : |
20
20
contains(github.event.pull_request.labels.*.name, 'hil_test') ||
21
+ contains(github.event.pull_request.labels.*.name, 'perf_test') ||
21
22
(github.event_name == 'schedule' && github.repository == 'espressif/arduino-esp32')
22
23
name : Generate Chunks matrix
23
24
runs-on : ubuntu-latest
24
25
outputs :
25
26
chunks : ${{ steps.gen-chunks.outputs.chunks }}
27
+ test_folder : ${{ steps.gen-chunks.outputs.test_folder }}
28
+ test_type : ${{ steps.gen-chunks.outputs.test_type }}
26
29
steps :
27
30
- name : Checkout Repository
28
31
uses : actions/checkout@v4
@@ -31,15 +34,29 @@ jobs:
31
34
id : gen-chunks
32
35
run : |
33
36
set +e
34
- .github/scripts/sketch_utils.sh count tests
37
+ if [ "${{contains(github.event.pull_request.labels.*.name, 'hil_test')}}" == "true" ] && \
38
+ [ "${{contains(github.event.pull_request.labels.*.name, 'perf_test')}}" == "false" ]; then
39
+ test_folder="tests/validation"
40
+ test_type="validation"
41
+ elif [ "${{contains(github.event.pull_request.labels.*.name, 'hil_test')}}" == "false" ] && \
42
+ [ "${{contains(github.event.pull_request.labels.*.name, 'perf_test')}}" == "true" ]; then
43
+ test_folder="tests/performance"
44
+ test_type="performance"
45
+ else
46
+ test_folder="tests"
47
+ test_type="all"
48
+ fi
49
+ .github/scripts/sketch_utils.sh count $test_folder
35
50
sketches=$?
36
51
if [[ $sketches -ge ${{env.MAX_CHUNKS}} ]]; then
37
52
$sketches=${{env.MAX_CHUNKS}}
38
53
fi
39
54
set -e
40
55
rm sketches.txt
41
56
CHUNKS=$(jq -c -n '$ARGS.positional' --args `seq 0 1 $((sketches - 1))`)
42
- echo "chunks=${CHUNKS}" >>$GITHUB_OUTPUT
57
+ echo "chunks=${CHUNKS}" >> $GITHUB_OUTPUT
58
+ echo "test_folder=${test_folder}" >> $GITHUB_OUTPUT
59
+ echo "test_type=${test_type}" >> $GITHUB_OUTPUT
43
60
44
61
Build :
45
62
needs : gen_chunks
@@ -54,15 +71,15 @@ jobs:
54
71
uses : actions/checkout@v4
55
72
- name : Build sketches
56
73
run : |
57
- bash .github/scripts/tests_build.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}}
74
+ bash .github/scripts/tests_build.sh -c -type ${{ needs.gen_chunks.outputs.test_type }} - t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}}
58
75
- name : Upload ${{matrix.chip}}-${{matrix.chunks}} artifacts
59
76
uses : actions/upload-artifact@v4
60
77
with :
61
78
name : ${{matrix.chip}}-${{matrix.chunks}}.artifacts
62
79
path : |
63
- ~/.arduino/tests/*/build*.tmp/*.bin
64
- ~/.arduino/tests/*/build*.tmp/*.json
65
- if-no-files-found : error
80
+ ~/.arduino/tests/** /build*.tmp/*.bin
81
+ ~/.arduino/tests/** /build*.tmp/*.json
82
+
66
83
Test :
67
84
needs : [gen_chunks, Build]
68
85
name : ${{matrix.chip}}-Test#${{matrix.chunks}}
@@ -77,36 +94,48 @@ jobs:
77
94
options : --privileged
78
95
79
96
steps :
80
- - name : Checkout repository
81
- uses : actions/checkout@v4
97
+ - name : Checkout repository
98
+ uses : actions/checkout@v4
82
99
83
- - name : Download ${{matrix.chip}}-${{matrix.chunks}} artifacts
84
- uses : actions/download-artifact@v4
85
- with :
86
- name : ${{matrix.chip}}-${{matrix.chunks}}.artifacts
87
- path : ~/.arduino/tests/
100
+ - name : Check if test artifacts are available
101
+ id : check-artifact
102
+ uses : LIT-Protocol/artifact-exists-action@v0
103
+ with :
104
+ name : ${{matrix.chip}}-${{matrix.chunks}}.artifacts
105
+
106
+ - name : Download ${{matrix.chip}}-${{matrix.chunks}} artifacts
107
+ uses : actions/download-artifact@v4
108
+ if : ${{ steps.check-artifact.outputs.exists == 'true' }}
109
+ with :
110
+ name : ${{matrix.chip}}-${{matrix.chunks}}.artifacts
111
+ path : ~/.arduino/tests/
88
112
89
- - name : Install dependencies
90
- run : |
91
- pip install -U pip
92
- pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
93
- apt update && apt install -y -qq jq
113
+ - name : Install dependencies
114
+ if : ${{ steps.check-artifact.outputs.exists == 'true' }}
115
+ run : |
116
+ pip install -U pip
117
+ pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
118
+ apt update && apt install -y -qq jq
94
119
95
- - name : Run Tests
96
- run : |
97
- bash .github/scripts/tests_run.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}} -e
120
+ - name : Run Tests
121
+ if : ${{ steps.check-artifact.outputs.exists == 'true' }}
122
+ run : |
123
+ bash .github/scripts/tests_run.sh -c -type ${{ needs.gen_chunks.outputs.test_type }} -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}} -e
98
124
99
- - name : Upload test result artifacts
100
- uses : actions/upload-artifact@v4
101
- if : always()
102
- with :
103
- name : test_results-${{matrix.chip}}-${{matrix.chunks}}
104
- path : tests/*/*.xml
125
+ - name : Upload test result artifacts
126
+ uses : actions/upload-artifact@v4
127
+ if : ${{ always() && steps.check-artifact.outputs.exists == 'true' }}
128
+ with :
129
+ name : test_results-${{matrix.chip}}-${{matrix.chunks}}
130
+ path : |
131
+ tests/**/*.xml
132
+ tests/**/result_*.json
105
133
106
134
event_file :
107
135
name : " Event File"
108
136
if : |
109
137
contains(github.event.pull_request.labels.*.name, 'hil_test') ||
138
+ contains(github.event.pull_request.labels.*.name, 'perf_test') ||
110
139
github.event_name == 'schedule'
111
140
needs : Test
112
141
runs-on : ubuntu-latest
0 commit comments