1- name : Run tests in hardware
1+ name : Run tests
22
33on :
44 pull_request :
@@ -16,9 +16,7 @@ concurrency:
1616
1717jobs :
1818 gen_chunks :
19- if : |
20- contains(github.event.pull_request.labels.*.name, 'hil_test') ||
21- (github.event_name == 'schedule' && github.repository == 'espressif/arduino-esp32')
19+ if : github.repository == 'espressif/arduino-esp32'
2220 name : Generate Chunks matrix
2321 runs-on : ubuntu-latest
2422 outputs :
4139 CHUNKS=$(jq -c -n '$ARGS.positional' --args `seq 0 1 $((sketches - 1))`)
4240 echo "chunks=${CHUNKS}" >>$GITHUB_OUTPUT
4341
44- Build :
42+ build :
4543 needs : gen_chunks
4644 name : ${{matrix.chip}}-Build#${{matrix.chunks}}
4745 runs-on : ubuntu-latest
6361 ~/.arduino/tests/*/build*.tmp/*.bin
6462 ~/.arduino/tests/*/build*.tmp/*.json
6563 if-no-files-found : error
66- Test :
67- needs : [gen_chunks, Build]
68- name : ${{matrix.chip}}-Test#${{matrix.chunks}}
64+
65+ qemu-test :
66+ needs : [gen_chunks, build]
67+ name : ${{matrix.chip}}-QEMU_Test#${{matrix.chunks}}
68+ strategy :
69+ fail-fast : false
70+ matrix :
71+ chip : ['esp32', 'esp32c3'] # Currently only ESP32 and ESP32-C3 are supported by QEMU
72+ chunks : ${{fromJson(needs.gen_chunks.outputs.chunks)}}
73+ runs-on : ubuntu-latest
74+ steps :
75+ - name : Checkout repository
76+ uses : actions/checkout@v4
77+
78+ - name : Get QEMU version
79+ uses :
pozetroninc/[email protected] 80+ id : get-qemu-version
81+ with :
82+ owner : espressif
83+ repo : qemu
84+ excludes : prerelease, draft
85+
86+ - name : Cache tools
87+ id : cache-linux
88+ uses : actions/cache@v4
89+ with :
90+ path : |
91+ ~/qemu
92+ ~/.cache/pip
93+ key : ${{ steps.get-qemu-version.outputs.release }}-${{ hashFiles('.github/workflows/hil.yml') }}
94+
95+ - name : Install python dependencies
96+ run : |
97+ pip install -U pip
98+ pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
99+
100+ - name : Download QEMU
101+ if : steps.cache-linux.outputs.cache-hit != 'true'
102+ run : |
103+ cd ~
104+ underscore_release=$(echo ${{ steps.get-qemu-version.outputs.release }} | sed 's/\-/_/g')
105+ wget -q https://github.com/espressif/qemu/releases/download/${{ steps.get-qemu-version.outputs.release }}/qemu-riscv32-softmmu-$underscore_release-x86_64-linux-gnu.tar.xz -o qemu-riscv32.tar.xz
106+ wget -q https://github.com/espressif/qemu/releases/download/${{ steps.get-qemu-version.outputs.release }}/qemu-xtensa-softmmu-$underscore_release-x86_64-linux-gnu.tar.xz -o qemu-xtensa.tar.xz
107+ tar -xf qemu-riscv32.tar.xz
108+ tar -xf --overwrite qemu-xtensa.tar.xz
109+ rm qemu-*
110+ ls -R
111+ echo "QEMU_PATH=~/qemu" >> $GITHUB_ENV
112+
113+ - name : Download ${{matrix.chip}}-${{matrix.chunks}} artifacts
114+ uses : actions/download-artifact@v4
115+ with :
116+ name : ${{matrix.chip}}-${{matrix.chunks}}.artifacts
117+ path : ~/.arduino/tests/
118+
119+ - name : Run Tests
120+ env :
121+ QEMU_PATH : ${{env.QEMU_PATH}}
122+ run : |
123+ bash .github/scripts/tests_run.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}} -q
124+
125+ - name : Upload test result artifacts
126+ uses : actions/upload-artifact@v4
127+ if : always()
128+ with :
129+ name : qemu_results-${{matrix.chip}}-${{matrix.chunks}}
130+ path : tests/*/*.xml
131+
132+ hardware-test :
133+ needs : [gen_chunks, build]
134+ name : ${{matrix.chip}}-Hardware_Test#${{matrix.chunks}}
135+ if : |
136+ contains(github.event.pull_request.labels.*.name, 'hil_test') || github.event_name == 'schedule'
69137 strategy :
70138 fail-fast : false
71139 matrix :
@@ -100,15 +168,13 @@ jobs:
100168 uses : actions/upload-artifact@v4
101169 if : always()
102170 with :
103- name : test_results -${{matrix.chip}}-${{matrix.chunks}}
171+ name : hw_results -${{matrix.chip}}-${{matrix.chunks}}
104172 path : tests/*/*.xml
105173
106174 event_file :
107175 name : " Event File"
108- if : |
109- contains(github.event.pull_request.labels.*.name, 'hil_test') ||
110- github.event_name == 'schedule'
111- needs : Test
176+ if : ${{ always() && !failure() && !cancelled() }}
177+ needs : [hardware-test, qemu-test]
112178 runs-on : ubuntu-latest
113179 steps :
114180 - name : Upload
0 commit comments