|
|
|
|
@@ -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"
|
|
|
|
|
@@ -106,30 +118,45 @@ jobs:
|
|
|
|
|
-F "attachment=@get-started/csi_recv_router/build/csi_recv_router.bin" \
|
|
|
|
|
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=csi_recv_router.bin"
|
|
|
|
|
|
|
|
|
|
# Store release URL for OTA
|
|
|
|
|
FIRMWARE_URL="https://git.mymx.me/$REPO/releases/download/$TAG/csi_recv_router.bin"
|
|
|
|
|
echo "Firmware URL: $FIRMWARE_URL"
|
|
|
|
|
echo "$FIRMWARE_URL" > /tmp/firmware_url.txt
|
|
|
|
|
|
|
|
|
|
- name: Deploy via OTA
|
|
|
|
|
run: |
|
|
|
|
|
FIRMWARE_URL=$(cat /tmp/firmware_url.txt)
|
|
|
|
|
echo "Using firmware URL: $FIRMWARE_URL"
|
|
|
|
|
cd workspace
|
|
|
|
|
SENSORS="muddy-storm:192.168.129.29 amber-maple:192.168.129.30 hollow-acorn:192.168.129.31"
|
|
|
|
|
OTA_PORT=8899
|
|
|
|
|
|
|
|
|
|
# Deploy to muddy-storm
|
|
|
|
|
echo "=== Deploying to muddy-storm (192.168.129.29) ==="
|
|
|
|
|
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.29 5501 || true
|
|
|
|
|
sleep 30
|
|
|
|
|
# Get runner IP (first non-loopback interface)
|
|
|
|
|
RUNNER_IP=$(hostname -I | awk '{print $1}')
|
|
|
|
|
echo "Runner IP: $RUNNER_IP"
|
|
|
|
|
|
|
|
|
|
# Deploy to amber-maple
|
|
|
|
|
echo "=== Deploying to amber-maple (192.168.129.30) ==="
|
|
|
|
|
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.30 5501 || true
|
|
|
|
|
sleep 30
|
|
|
|
|
# Start HTTP server to serve firmware
|
|
|
|
|
cd get-started/csi_recv_router/build
|
|
|
|
|
python3 -m http.server $OTA_PORT &
|
|
|
|
|
HTTP_PID=$!
|
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
|
|
# Deploy to hollow-acorn
|
|
|
|
|
echo "=== Deploying to hollow-acorn (192.168.129.31) ==="
|
|
|
|
|
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.31 5501 || true
|
|
|
|
|
sleep 30
|
|
|
|
|
FIRMWARE_URL="http://${RUNNER_IP}:${OTA_PORT}/csi_recv_router.bin"
|
|
|
|
|
echo "Firmware URL: $FIRMWARE_URL"
|
|
|
|
|
|
|
|
|
|
# Verify server is running
|
|
|
|
|
curl -sI "http://localhost:${OTA_PORT}/csi_recv_router.bin" | head -1
|
|
|
|
|
|
|
|
|
|
# Deploy to all sensors in parallel
|
|
|
|
|
echo "=== Deploying to all sensors in parallel ==="
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
# Stop HTTP server
|
|
|
|
|
kill $HTTP_PID 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
echo "=== Deployment complete ==="
|
|
|
|
|
|
|
|
|
|
|