test(ci): added the correct path in the action script #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TFLMWrapper ESP32 Integration Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache pip packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache PlatformIO packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }} | |
restore-keys: | | |
${{ runner.os }}-platformio- | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install platformio | |
sudo apt-get update | |
sudo apt-get install -y wget xz-utils | |
- name: Install ESP32 toolchain | |
run: | | |
platformio platform install espressif32 | |
platformio platform install native | |
- name: Set up QEMU for ESP32-S3 | |
run: | | |
wget https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz | |
tar xf qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz | |
sudo mv qemu/bin/qemu-system-xtensa /usr/local/bin/ | |
sudo chmod +x /usr/local/bin/qemu-system-xtensa | |
- name: Run tests with QEMU | |
run: | | |
# Create a script to run tests with QEMU | |
echo '#!/bin/bash | |
qemu-system-xtensa \ | |
-machine esp32s3 \ | |
-nographic \ | |
-drive file=flash.bin,if=mtd,format=raw \ | |
-global driver=timer.esp32.timg,property=wdt_disable,value=true \ | |
-kernel .pio/build/esp32-s3-devkitc-1/firmware.elf \ | |
-serial stdio' > run_tests.sh | |
chmod +x run_tests.sh | |
# Create an empty flash file | |
dd if=/dev/zero of=flash.bin bs=1M count=4 | |
# Build and run tests | |
platformio test -e esp32-s3-devkitc-1 2>&1 | tee test_output.log | |
# Check test results | |
if grep -q "PASSED" test_output.log; then | |
echo "Tests passed successfully!" | |
exit 0 | |
else | |
echo "Tests failed!" | |
exit 1 | |
fi | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: | | |
test_output.log | |
.pio/build/esp32-s3-devkitc-1/test_output.txt |