feat: Increase timeout for backend E2E tests; add logging for backend startup and show logs on failure; mark subproject commits as dirty
This commit is contained in:
parent
d4a48e6e1e
commit
ce3c5f8cf5
|
|
@ -9,7 +9,7 @@ on:
|
|||
jobs:
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
timeout-minutes: 30
|
||||
|
||||
env:
|
||||
QEMU_RELEASE_URL: https://github.com/davidmonterocrespo24/velxio/releases/download/qemu-prebuilt
|
||||
|
|
@ -38,7 +38,11 @@ jobs:
|
|||
chmod +x libqemu-xtensa.so libqemu-riscv32.so
|
||||
ls -lh .
|
||||
|
||||
# ── arduino-cli + ESP32 core ───────────────────────────────────────────────
|
||||
# Report missing shared-library dependencies (if any)
|
||||
echo "=== ldd libqemu-xtensa.so ==="
|
||||
ldd libqemu-xtensa.so || true
|
||||
|
||||
# ── arduino-cli + ESP32 core + required libraries ──────────────────────────
|
||||
- name: Install arduino-cli
|
||||
run: |
|
||||
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh \
|
||||
|
|
@ -47,10 +51,12 @@ jobs:
|
|||
- name: Cache arduino-cli cores and libraries
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.arduino15
|
||||
key: arduino-cores-esp32-${{ runner.os }}-v1
|
||||
path: |
|
||||
~/.arduino15
|
||||
~/Arduino/libraries
|
||||
key: arduino-cores-esp32-libs-${{ runner.os }}-v2
|
||||
|
||||
- name: Install ESP32 arduino core
|
||||
- name: Install ESP32 arduino core and required libraries
|
||||
run: |
|
||||
arduino-cli config init --overwrite
|
||||
arduino-cli config add board_manager.additional_urls \
|
||||
|
|
@ -58,6 +64,13 @@ jobs:
|
|||
arduino-cli core update-index
|
||||
arduino-cli core install esp32:esp32
|
||||
|
||||
# Libraries needed by the e2e test sketches
|
||||
# DHT22 test needs: DHT sensor library
|
||||
# MPU6050 test needs: Adafruit MPU6050 + Adafruit Unified Sensor
|
||||
arduino-cli lib install "DHT sensor library"
|
||||
arduino-cli lib install "Adafruit MPU6050"
|
||||
arduino-cli lib install "Adafruit Unified Sensor"
|
||||
|
||||
# ── Python + backend dependencies ─────────────────────────────────────────
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@v5
|
||||
|
|
@ -83,9 +96,8 @@ jobs:
|
|||
- name: Start backend server
|
||||
run: |
|
||||
cd backend
|
||||
QEMU_ESP32_LIB=$QEMU_DIR/libqemu-xtensa.so \
|
||||
QEMU_RISCV32_LIB=$QEMU_DIR/libqemu-riscv32.so \
|
||||
uvicorn app.main:app --port 8001 &
|
||||
uvicorn app.main:app --port 8001 --log-level info \
|
||||
> /tmp/backend.log 2>&1 &
|
||||
echo "Backend PID: $!"
|
||||
env:
|
||||
QEMU_ESP32_LIB: /opt/velxio-qemu/libqemu-xtensa.so
|
||||
|
|
@ -94,35 +106,41 @@ jobs:
|
|||
- name: Wait for backend to be ready
|
||||
run: |
|
||||
echo "Waiting for backend on port 8001..."
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf http://localhost:8001/docs > /dev/null 2>&1; then
|
||||
for i in $(seq 1 60); do
|
||||
if curl -sf http://localhost:8001/health > /dev/null 2>&1; then
|
||||
echo "Backend is up after ${i}s"
|
||||
break
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
curl -sf http://localhost:8001/docs > /dev/null || (echo "Backend failed to start" && exit 1)
|
||||
echo "=== Backend failed to start — last 80 lines of log: ==="
|
||||
tail -80 /tmp/backend.log || echo "(no log file)"
|
||||
exit 1
|
||||
|
||||
# ── Run e2e tests ─────────────────────────────────────────────────────────
|
||||
#
|
||||
# These tests compile real firmware via the backend and run full simulations
|
||||
# over WebSocket. Each test has a generous timeout because compilation +
|
||||
# firmware boot takes 30-60 s.
|
||||
# These tests compile real firmware via arduino-cli and run full simulations
|
||||
# over WebSocket using libqemu-xtensa.so. Each test has a generous timeout
|
||||
# because ESP32 firmware compilation + QEMU boot takes 30-90 s.
|
||||
#
|
||||
# NOT run here (require Windows DLLs, not .so):
|
||||
# test/backend/integration/ — uses libqemu-xtensa.dll (Windows only)
|
||||
#
|
||||
- name: Run DHT22 e2e test
|
||||
run: node test/backend/e2e/test_dht22_simulation.mjs --timeout=60
|
||||
env:
|
||||
BACKEND_URL: http://localhost:8001
|
||||
|
||||
- name: Run HC-SR04 e2e test
|
||||
run: node test/backend/e2e/test_hcsr04_simulation.mjs --timeout=75
|
||||
env:
|
||||
BACKEND_URL: http://localhost:8001
|
||||
|
||||
- name: Run MPU-6050 e2e test
|
||||
run: node test/backend/e2e/test_mpu6050_simulation.mjs --timeout=60
|
||||
- name: Run DHT22 e2e test
|
||||
run: node test/backend/e2e/test_dht22_simulation.mjs --timeout=90
|
||||
env:
|
||||
BACKEND_URL: http://localhost:8001
|
||||
|
||||
- name: Run MPU-6050 e2e test
|
||||
run: node test/backend/e2e/test_mpu6050_simulation.mjs --timeout=90
|
||||
env:
|
||||
BACKEND_URL: http://localhost:8001
|
||||
|
||||
# ── Always dump backend logs so failures are diagnosable ──────────────────
|
||||
- name: Show backend logs
|
||||
if: always()
|
||||
run: |
|
||||
echo "=== Backend log (last 150 lines) ==="
|
||||
tail -150 /tmp/backend.log || echo "(no log file)"
|
||||
|
|
|
|||
Loading…
Reference in New Issue