Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbf2e9a7c1 | ||
|
|
1377abe248 | ||
|
|
551225d308 | ||
|
|
7f2e3f6dad | ||
|
|
a85a2d776b |
@@ -23,18 +23,32 @@ jobs:
|
||||
runs-on: anvil
|
||||
container:
|
||||
image: docker.io/espressif/idf:v5.3
|
||||
volumes:
|
||||
- /var/cache/ccache:/ccache
|
||||
env:
|
||||
CCACHE_DIR: /ccache
|
||||
IDF_CCACHE_ENABLE: 1
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone --depth=1 --branch=${{ github.ref_name }} \
|
||||
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git .
|
||||
|
||||
- name: Setup ccache
|
||||
run: |
|
||||
apt-get update && apt-get install -y --no-install-recommends ccache
|
||||
ccache --zero-stats
|
||||
ccache --show-config | grep -E "(cache_dir|max_size)"
|
||||
|
||||
- name: Build firmware
|
||||
run: |
|
||||
. /opt/esp/idf/export.sh
|
||||
cd get-started/csi_recv_router
|
||||
idf.py build
|
||||
|
||||
- name: Show ccache stats
|
||||
run: ccache --show-stats
|
||||
|
||||
- name: Show binary size
|
||||
run: |
|
||||
ls -lh get-started/csi_recv_router/build/*.bin
|
||||
@@ -54,21 +68,18 @@ jobs:
|
||||
runs-on: anvil
|
||||
needs: build
|
||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true' || startsWith(github.ref, 'refs/tags/v')
|
||||
container:
|
||||
image: docker.io/espressif/idf:v5.3
|
||||
# Run directly on host (no container) to access local network
|
||||
steps:
|
||||
- name: Install tools
|
||||
run: |
|
||||
apt-get update && apt-get install -y --no-install-recommends netcat-openbsd curl jq
|
||||
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone --depth=1 --branch=${{ github.ref_name }} \
|
||||
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git .
|
||||
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git workspace
|
||||
cd workspace
|
||||
|
||||
- name: Build firmware
|
||||
run: |
|
||||
. /opt/esp/idf/export.sh
|
||||
cd workspace
|
||||
. $HOME/esp/esp-idf/export.sh
|
||||
cd get-started/csi_recv_router
|
||||
idf.py build
|
||||
|
||||
@@ -76,6 +87,7 @@ jobs:
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
cd workspace
|
||||
TAG="${{ github.ref_name }}"
|
||||
REPO="${{ github.repository }}"
|
||||
API_URL="https://git.mymx.me/api/v1"
|
||||
@@ -108,9 +120,10 @@ jobs:
|
||||
|
||||
- name: Deploy via OTA
|
||||
run: |
|
||||
cd workspace
|
||||
SENSORS="muddy-storm:192.168.129.29 amber-maple:192.168.129.30 hollow-acorn:192.168.129.31"
|
||||
FIRMWARE_PATH="get-started/csi_recv_router/build/csi_recv_router.bin"
|
||||
OTA_PORT=8899
|
||||
EXPECTED_VERSION="${{ github.ref_name }}"
|
||||
|
||||
# Get runner IP (first non-loopback interface)
|
||||
RUNNER_IP=$(hostname -I | awk '{print $1}')
|
||||
@@ -128,19 +141,65 @@ jobs:
|
||||
# Verify server is running
|
||||
curl -sI "http://localhost:${OTA_PORT}/csi_recv_router.bin" | head -1
|
||||
|
||||
# Deploy to each sensor
|
||||
# Deploy to all sensors in parallel
|
||||
echo "=== Deploying to all sensors in parallel ==="
|
||||
for entry in $SENSORS; do
|
||||
NAME="${entry%%:*}"
|
||||
IP="${entry##*:}"
|
||||
echo "=== Deploying to $NAME ($IP) ==="
|
||||
echo "OTA $FIRMWARE_URL" | nc -u -w 2 "$IP" 5501 || true
|
||||
sleep 45
|
||||
echo "OTA $FIRMWARE_URL" | nc -u -w 2 "$IP" 5501 &
|
||||
done
|
||||
wait
|
||||
|
||||
# Monitor progress
|
||||
echo "=== Monitoring OTA progress (timeout: 90s) ==="
|
||||
TIMEOUT=90
|
||||
INTERVAL=5
|
||||
ELAPSED=0
|
||||
|
||||
while [ $ELAPSED -lt $TIMEOUT ]; do
|
||||
sleep $INTERVAL
|
||||
ELAPSED=$((ELAPSED + INTERVAL))
|
||||
|
||||
echo "--- Progress check at ${ELAPSED}s ---"
|
||||
ALL_UPDATED=true
|
||||
|
||||
for entry in $SENSORS; do
|
||||
NAME="${entry%%:*}"
|
||||
IP="${entry##*:}"
|
||||
|
||||
# Query sensor version via UDP STATUS command
|
||||
RESPONSE=$(echo "STATUS" | nc -u -w 1 "$IP" 5501 2>/dev/null || echo "")
|
||||
VERSION=$(echo "$RESPONSE" | grep -oP 'version=\K[^ ]+' || echo "offline")
|
||||
|
||||
if [ "$VERSION" = "$EXPECTED_VERSION" ]; then
|
||||
echo " $NAME: ✓ $VERSION"
|
||||
elif [ "$VERSION" = "offline" ] || [ -z "$VERSION" ]; then
|
||||
echo " $NAME: ⟳ updating..."
|
||||
ALL_UPDATED=false
|
||||
else
|
||||
echo " $NAME: $VERSION (waiting for $EXPECTED_VERSION)"
|
||||
ALL_UPDATED=false
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$ALL_UPDATED" = true ]; then
|
||||
echo "=== All sensors updated to $EXPECTED_VERSION ==="
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Stop HTTP server
|
||||
kill $HTTP_PID 2>/dev/null || true
|
||||
|
||||
echo "=== Deployment complete ==="
|
||||
# Final status
|
||||
echo "=== Final sensor status ==="
|
||||
for entry in $SENSORS; do
|
||||
NAME="${entry%%:*}"
|
||||
IP="${entry##*:}"
|
||||
RESPONSE=$(echo "STATUS" | nc -u -w 1 "$IP" 5501 2>/dev/null || echo "")
|
||||
VERSION=$(echo "$RESPONSE" | grep -oP 'version=\K[^ ]+' || echo "offline")
|
||||
echo " $NAME: $VERSION"
|
||||
done
|
||||
|
||||
cppcheck:
|
||||
name: C/C++ Static Analysis
|
||||
|
||||
@@ -1532,14 +1532,6 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
|
||||
/* Partition info */
|
||||
const esp_partition_t *running = esp_ota_get_running_partition();
|
||||
uint32_t part_size = running ? running->size : 0;
|
||||
uint32_t app_size = 0;
|
||||
if (running) {
|
||||
esp_app_desc_t desc;
|
||||
if (esp_ota_get_partition_description(running, &desc) == ESP_OK) {
|
||||
/* App size not directly available, use partition size */
|
||||
app_size = part_size;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(reply, reply_size,
|
||||
"OK STATUS uptime=%s uptime_s=%lld heap=%lu rssi=%d channel=%d tx_power=%d rate=%d csi_rate=%d"
|
||||
|
||||
Reference in New Issue
Block a user