Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a338c9f65f | ||
|
|
fbf2e9a7c1 |
@@ -71,23 +71,17 @@ jobs:
|
||||
# Run directly on host (no container) to access local network
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone --depth=1 --branch=${{ github.ref_name }} \
|
||||
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git workspace
|
||||
cd workspace
|
||||
run: git clone --depth=1 --branch=${{ github.ref_name }} https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git workspace
|
||||
|
||||
- name: Build firmware
|
||||
run: |
|
||||
cd workspace
|
||||
. $HOME/esp/esp-idf/export.sh
|
||||
cd get-started/csi_recv_router
|
||||
idf.py build
|
||||
cd workspace && . $HOME/esp/esp-idf/export.sh && cd get-started/csi_recv_router && idf.py build
|
||||
|
||||
- name: Create release and upload firmware
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
working-directory: workspace
|
||||
run: |
|
||||
cd workspace
|
||||
TAG="${{ github.ref_name }}"
|
||||
REPO="${{ github.repository }}"
|
||||
API_URL="https://git.mymx.me/api/v1"
|
||||
@@ -119,10 +113,11 @@ jobs:
|
||||
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=csi_recv_router.bin"
|
||||
|
||||
- name: Deploy via OTA
|
||||
working-directory: workspace
|
||||
run: |
|
||||
cd workspace
|
||||
SENSORS="muddy-storm:192.168.129.29 amber-maple:192.168.129.30 hollow-acorn:192.168.129.31"
|
||||
OTA_PORT=8899
|
||||
EXPECTED_VERSION="${{ github.ref_name }}"
|
||||
|
||||
# Get runner IP (first non-loopback interface)
|
||||
RUNNER_IP=$(hostname -I | awk '{print $1}')
|
||||
@@ -145,20 +140,60 @@ jobs:
|
||||
for entry in $SENSORS; do
|
||||
NAME="${entry%%:*}"
|
||||
IP="${entry##*:}"
|
||||
echo "=== Starting OTA on $NAME ($IP) ==="
|
||||
echo "OTA $FIRMWARE_URL" | nc -u -w 2 "$IP" 5501 &
|
||||
done
|
||||
|
||||
# Wait for OTA commands to be sent
|
||||
wait
|
||||
|
||||
echo "=== OTA commands sent, waiting for devices to update (60s) ==="
|
||||
sleep 60
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user