initial attempt at 2 ToFs #124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compile Sketch | |
on: | |
push: | |
branches: [main] | |
tags: ["v*.*.*"] | |
pull_request: | |
branches: | |
- main | |
jobs: | |
compile-sketches: | |
name: ${{ matrix.board.fqbn }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
board: | |
# senseBox MCU | |
- fqbn: sensebox:samd:sb:power=on | |
platforms: | | |
- name: arduino:samd | |
- name: sensebox:samd | |
source-url: https://raw.githubusercontent.com/mariopesch/senseBoxMCU-core/master/package_sensebox_index.json | |
sketch-paths: | | |
- ./senseBox-bike | |
artifact-name-suffix: sensebox.samd.sb | |
# senseBox MCU S2 (ESP32) | |
- fqbn: esp32:esp32:sensebox_mcu_esp32s2 | |
platforms: | | |
- name: esp32:esp32 | |
source-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json | |
version: 2.0.17 | |
sketch-paths: | | |
- ./senseBox-bike-atrai | |
- ./senseBox-bike-mcus2 | |
artifact-name-suffix: esp32.esp32.sensebox_mcu_esp32s2 | |
steps: | |
# This step makes the contents of the repository available to the workflow | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# For more information: https://github.com/arduino/compile-sketches#readme | |
- name: "[Arduino CLI] Compile sketch" | |
uses: arduino/compile-sketches@v1 | |
with: | |
fqbn: ${{ matrix.board.fqbn }} | |
platforms: ${{ matrix.board.platforms }} | |
sketch-paths: ${{ matrix.board.sketch-paths }} | |
libraries: | | |
- name: SenseBoxBLE | |
- name: "Adafruit HDC1000 Library" | |
- name: sensirion-sps | |
- name: "Adafruit MPU6050" | |
- name: NewPing | |
- name: "STM32duino VL53L8CX" | |
version: 1.0.4 | |
- name: "Adafruit GFX Library" | |
- name: "Adafruit SSD1306" | |
- source-url: https://github.com/felixerdy/QRCodeGenerator.git | |
- name: "Adafruit MAX1704X" | |
- name: SDConfig | |
- name: SD | |
- name: Ethernet | |
- name: NeoGPS | |
- name: WiFi101 | |
- name: TinyGPSPlus | |
- name: OneWire | |
- name: DallasTemperature | |
enable-deltas-report: true | |
enable-warnings-report: true | |
cli-compile-flags: | | |
- --export-binaries | |
- name: Create OTA update file | |
if: startsWith(matrix.board.fqbn, 'esp32') | |
run: | | |
git clone https://github.com/arduino-libraries/ArduinoIoTCloud.git | |
pip install crccheck | |
cd ArduinoIoTCloud/extras/tools | |
# Set the Internal Field Separator to newline to handle paths correctly | |
IFS=$'\n' | |
# Convert the list of sketch paths into an array | |
sketch_paths=(${{ matrix.board.sketch-paths }}) | |
for sketch_path in "${sketch_paths[@]}"; do | |
if [[ "$sketch_path" != "-" ]]; then | |
echo "Processing sketch path: $sketch_path" | |
# replace ./ with nothing | |
clean_sketch_path=${sketch_path//.\//} | |
python3 lzss.py --encode ${{ github.workspace }}/$sketch_path/build/${{ matrix.board.artifact-name-suffix}}/$clean_sketch_path.ino.bin ${{ runner.temp }}/$clean_sketch_path.ino.lzss | |
echo "LZSS file created: ${{ runner.temp }}/$clean_sketch_path.ino.lzss" | |
python3 bin2ota.py ESP32 ${{ runner.temp }}/$clean_sketch_path.ino.lzss ${{ runner.temp }}/$clean_sketch_path.ino.ota | |
echo "OTA file created: ${{ runner.temp }}/$clean_sketch_path.ino.ota" | |
mv ${{ runner.temp }}/$clean_sketch_path.ino.ota ${{ github.workspace }}/$sketch_path/build/${{ matrix.board.artifact-name-suffix}}/$clean_sketch_path.ino.ota | |
fi | |
done | |
- name: Export binaries as artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.board.artifact-name-suffix }} | |
path: ${{ github.workspace }} | |
release: | |
needs: compile-sketches | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Firmware Files | |
uses: actions/download-artifact@v4 | |
with: | |
path: release | |
- name: Release Firmware | |
uses: ncipollo/release-action@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
artifacts: "release/**/*.bin, release/**/*.ota" | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
token: ${{ secrets.GITHUB_TOKEN }} |