Skip to content

Commit c2b0482

Browse files
lucasssvazSuGliderme-no-dev
authored
ci(hw): Fix files being overwritten (#11019)
Co-authored-by: Sugar Glider <[email protected]> Co-authored-by: Me No Dev <[email protected]>
1 parent 07d6a5a commit c2b0482

File tree

7 files changed

+36
-26
lines changed

7 files changed

+36
-26
lines changed

.github/scripts/sketch_utils.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ function build_sketch { # build_sketch <ide_path> <user_path> <path-to-ino> [ext
244244
build_dir="$ARDUINO_BUILD_DIR"
245245
elif [ "$len" -eq 1 ]; then
246246
# build_dir="$sketchdir/build"
247-
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
247+
build_dir="$HOME/.arduino/tests/$target/$sketchname/build.tmp"
248248
fi
249249

250250
output_file="$HOME/.arduino/cli_compile_output.txt"
@@ -254,7 +254,7 @@ function build_sketch { # build_sketch <ide_path> <user_path> <path-to-ino> [ext
254254
for i in $(seq 0 $((len - 1))); do
255255
if [ "$len" -ne 1 ]; then
256256
# build_dir="$sketchdir/build$i"
257-
build_dir="$HOME/.arduino/tests/$sketchname/build$i.tmp"
257+
build_dir="$HOME/.arduino/tests/$target/$sketchname/build$i.tmp"
258258
fi
259259
rm -rf "$build_dir"
260260
mkdir -p "$build_dir"

.github/scripts/tests_run.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ function run_test {
2727
fi
2828

2929
if [ "$len" -eq 1 ]; then
30-
sdkconfig_path="$HOME/.arduino/tests/$sketchname/build.tmp/sdkconfig"
30+
sdkconfig_path="$HOME/.arduino/tests/$target/$sketchname/build.tmp/sdkconfig"
3131
else
32-
sdkconfig_path="$HOME/.arduino/tests/$sketchname/build0.tmp/sdkconfig"
32+
sdkconfig_path="$HOME/.arduino/tests/$target/$sketchname/build0.tmp/sdkconfig"
3333
fi
3434

3535
if [ -f "$sketchdir"/ci.json ]; then
@@ -45,7 +45,7 @@ function run_test {
4545
fi
4646

4747
if [ ! -f "$sdkconfig_path" ]; then
48-
printf "\033[93mSketch %s not built\nMight be due to missing target requirements or build failure\033[0m\n" "$sketchname"
48+
printf "\033[93mSketch %s build not found in %s\nMight be due to missing target requirements or build failure\033[0m\n" "$(dirname "$sdkconfig_path")" "$sketchname"
4949
printf "\n\n\n"
5050
return 0
5151
fi
@@ -60,7 +60,7 @@ function run_test {
6060

6161
if [ "$len" -eq 1 ]; then
6262
# build_dir="$sketchdir/build"
63-
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
63+
build_dir="$HOME/.arduino/tests/$target/$sketchname/build.tmp"
6464
report_file="$sketchdir/$target/$sketchname.xml"
6565
fi
6666

@@ -83,7 +83,7 @@ function run_test {
8383

8484
if [ "$len" -ne 1 ]; then
8585
# build_dir="$sketchdir/build$i"
86-
build_dir="$HOME/.arduino/tests/$sketchname/build$i.tmp"
86+
build_dir="$HOME/.arduino/tests/$target/$sketchname/build$i.tmp"
8787
report_file="$sketchdir/$target/$sketchname$i.xml"
8888
fi
8989

.github/workflows/tests_build.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
with:
2727
key: tests-${{ env.id }}-bin
2828
path: |
29-
~/.arduino/tests/**/build*.tmp/*.bin
30-
~/.arduino/tests/**/build*.tmp/*.elf
31-
~/.arduino/tests/**/build*.tmp/*.json
32-
~/.arduino/tests/**/build*.tmp/sdkconfig
29+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.bin
30+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.elf
31+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.json
32+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/sdkconfig
3333
3434
- name: Evaluate if tests should be built
3535
id: check-build
@@ -73,18 +73,18 @@ jobs:
7373
with:
7474
key: tests-${{ env.id }}-bin
7575
path: |
76-
~/.arduino/tests/**/build*.tmp/*.bin
77-
~/.arduino/tests/**/build*.tmp/*.elf
78-
~/.arduino/tests/**/build*.tmp/*.json
79-
~/.arduino/tests/**/build*.tmp/sdkconfig
76+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.bin
77+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.elf
78+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.json
79+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/sdkconfig
8080
8181
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} binaries as artifacts
8282
uses: actions/upload-artifact@v4
8383
with:
8484
name: tests-bin-${{ inputs.chip }}-${{ inputs.type }}
8585
overwrite: true
8686
path: |
87-
~/.arduino/tests/**/build*.tmp/*.bin
88-
~/.arduino/tests/**/build*.tmp/*.elf
89-
~/.arduino/tests/**/build*.tmp/*.json
90-
~/.arduino/tests/**/build*.tmp/sdkconfig
87+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.bin
88+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.elf
89+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/*.json
90+
~/.arduino/tests/${{ inputs.chip }}/**/build*.tmp/sdkconfig

.github/workflows/tests_hw.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@ defaults:
2222
jobs:
2323
hardware-test:
2424
name: Hardware ${{ inputs.chip }} ${{ inputs.type }} tests
25-
runs-on: [arduino, "${{ inputs.chip }}"]
25+
runs-on: ["arduino", "${{ inputs.chip }}"]
2626
env:
2727
id: ${{ github.event.pull_request.number || github.ref }}-${{ github.event.pull_request.head.sha || github.sha }}-${{ inputs.chip }}-${{ inputs.type }}
2828
container:
2929
image: python:3.10.1-bullseye
30-
options: --privileged
30+
options: --privileged --device-cgroup-rule="c 188:* rmw" --device-cgroup-rule="c 166:* rmw"
3131
steps:
32+
- name: Clean workspace
33+
run: |
34+
rm -rf ./*
35+
rm -rf ~/.arduino/tests
36+
3237
- name: Check if already passed
3338
id: cache-results
3439
if: github.event.pull_request.number != null
@@ -81,7 +86,12 @@ jobs:
8186
with:
8287
name: tests-bin-${{ inputs.chip }}-${{ inputs.type }}
8388
path: |
84-
~/.arduino/tests
89+
~/.arduino/tests/${{ inputs.chip }}
90+
91+
- name: List binaries
92+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
93+
run: |
94+
ls -laR ~/.arduino/tests
8595
8696
- name: Run Tests
8797
if: ${{ steps.check-tests.outputs.enabled == 'true' }}

.github/workflows/tests_qemu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
with:
118118
name: tests-bin-${{ inputs.chip }}-${{ inputs.type }}
119119
path: |
120-
~/.arduino/tests
120+
~/.arduino/tests/${{ inputs.chip }}
121121
122122
- name: Run Tests
123123
if: ${{ steps.check-tests.outputs.enabled == 'true' }}

.github/workflows/tests_wokwi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ jobs:
276276
run-id: ${{ github.event.workflow_run.id }}
277277
name: tests-bin-${{ matrix.chip }}-${{ matrix.type }}
278278
path: |
279-
~/.arduino/tests
279+
~/.arduino/tests/${{ matrix.chip }}
280280
281281
- name: Run Tests
282282
if: ${{ steps.check-tests.outputs.enabled == 'true' }}

docs/en/contributing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ ESP32-C3 target, you would run:
318318
319319
./.github/scripts/tests_build.sh -s uart -t esp32c3
320320
321-
You should see the output of the build process and the test binary should be generated in the ``~/.arduino/tests/<test_name>/build.tmp`` folder.
321+
You should see the output of the build process and the test binary should be generated in the ``~/.arduino/tests/<target_chip>/<test_name>/build.tmp`` folder.
322322

323323
Now that the test is built, you can run it in the target board. Connect the target board to your computer and run:
324324

@@ -339,7 +339,7 @@ The test will run on the target board and you should see the output of the test
339339
lucassvaz@Lucas--MacBook-Pro esp32 % ./.github/scripts/tests_run.sh -s uart -t esp32c3
340340
Sketch uart test type: validation
341341
Running test: uart -- Config: Default
342-
pytest tests --build-dir /Users/lucassvaz/.arduino/tests/uart/build.tmp -k test_uart --junit-xml=/Users/lucassvaz/Espressif/Arduino/hardware/espressif/esp32/tests/validation/uart/esp32c3/uart.xml --embedded-services esp,arduino
342+
pytest tests --build-dir /Users/lucassvaz/.arduino/tests/esp32c3/uart/build.tmp -k test_uart --junit-xml=/Users/lucassvaz/Espressif/Arduino/hardware/espressif/esp32/tests/validation/uart/esp32c3/uart.xml --embedded-services esp,arduino
343343
=============================================================================================== test session starts ================================================================================================
344344
platform darwin -- Python 3.12.3, pytest-8.2.2, pluggy-1.5.0
345345
rootdir: /Users/lucassvaz/Espressif/Arduino/hardware/espressif/esp32/tests

0 commit comments

Comments
 (0)