Browse Source

CI: added test build

Andrew Tridgell 3 years ago
parent
commit
34ed6f7327
3 changed files with 58 additions and 5 deletions
  1. 44 0
      .github/workflows/test_build.yml
  2. 6 5
      RemoteIDModule/Makefile
  3. 8 0
      scripts/install_build_env.sh

+ 44 - 0
.github/workflows/test_build.yml

@@ -0,0 +1,44 @@
+name: Test Build
+
+on: [push, pull_request, workflow_dispatch]
+concurrency:
+  group: ci-${{github.workflow}}-${{ github.ref }}
+  cancel-in-progress: true
+
+jobs:
+  build:
+    runs-on: ubuntu-22.04
+
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: 'recursive'
+      - name: Setup ESP32
+        env:
+          HOME: ${{ runner.workspace }}/ArduRemoteID
+        run: |
+          ./scripts/install_build_env.sh
+          ./scripts/regen_headers.sh
+          ./scripts/add_libraries.sh
+
+      - name: Build
+        env:
+          HOME: ${{ runner.workspace }}/ArduRemoteID
+        run: |
+          cd RemoteIDModule
+          make setup
+          make all
+
+      - name: Check build files
+        id: check_files
+        uses: andstor/file-existence-action@v1
+        with:
+          files: "RemoteIDModule/ArduRemoteID.bin"
+          allow_failure: true
+
+      - name: Archive build
+        uses: actions/upload-artifact@v2
+        with:
+           name: binaries
+           path: RemoteIDModule/ArduRemoteID.bin
+           retention-days: 7

+ 6 - 5
RemoteIDModule/Makefile

@@ -7,6 +7,7 @@ ESPTOOL=$(ESP32_TOOLS)/esptool.py
 CHIP=esp32s3
 ESP32_FQBN=esp32:esp32:$(CHIP)
 SERDEV := $(wildcard /dev/serial/by-id/usb-Espressif_*)
+ARDUINO_CLI=../bin/arduino-cli
 
 
 all: ArduRemoteID.bin
@@ -17,23 +18,23 @@ ArduRemoteID.bin: ..esp32.esp32.esp32s3.bin
 
 setup:
 	@echo "Installing ESP32 support"
-	@arduino-cli core update-index --config-file arduino-cli.yaml
-	@arduino-cli core install esp32:esp32
+	@$(ARDUINO_CLI) core update-index --config-file arduino-cli.yaml
+	@$(ARDUINO_CLI) core install esp32:esp32
 
 ..esp32.esp32.$(CHIP).bin: *.cpp *.ino *.h
 	@echo "Building main binary"
-	@arduino-cli compile --fqbn $(ESP32_FQBN) .
+	@$(ARDUINO_CLI) compile --fqbn $(ESP32_FQBN) .
 
 boards:
 	@echo "Listing boards"
-	@arduino-cli board list
+	@$(ARDUINO_CLI) board list
 
 checkdev:
 	@[ "${SERDEV}" ] && echo "Using device $(SERDEV)" || ( echo "Failed to find serial device"; exit 1 )
 
 upload: checkdev ArduRemoteID.bin
 	@echo "Flashing"
-	@arduino-cli upload -p $(SERDEV) --fqbn $(ESP32_FQBN) .
+	@$(ARDUINO_CLI) upload -p $(SERDEV) --fqbn $(ESP32_FQBN) .
 
 clean:
 	rm -f ..esp32* *.bin

+ 8 - 0
scripts/install_build_env.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+python3 -m pip install empy
+python3 -m pip install pymavlink
+python3 -m pip install dronecan
+wget https://downloads.arduino.cc/arduino-cli/arduino-cli_0.26.0_Linux_64bit.tar.gz
+mkdir -p bin
+(cd bin && tar xvzf ../arduino-cli_0.26.0_Linux_64bit.tar.gz)