Skip to content

Commit

Permalink
fmt examples & add CI for arduino and PIO
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jul 11, 2021
1 parent b2bae57 commit 518d5fb
Show file tree
Hide file tree
Showing 25 changed files with 2,143 additions and 1,799 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/build_arduino.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Arduino CLI build

on:
pull_request:
types: [opened, reopened]
paths:
- ".github/workflows/build_arduino.yml"
- "examples/**"

push:
paths:
- ".github/workflows/build_arduino.yml"
- "examples/**"

jobs:
check_formatting:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check code formatting
uses: per1234/artistic-style-action@main
with:
options-file-path: ./examples/examples_formatter.conf
name-patterns: |
- '*.ino'
- '*.cpp'
- '*.hpp'
- '*.h'
target-paths: |
- examples
build:
needs: check_formatting
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
fqbn:
- "arduino:avr:yun"
- "arduino:avr:uno"
- "arduino:avr:diecimila"
- "arduino:avr:nano"
- "arduino:avr:mega"
- "arduino:avr:megaADK"
- "arduino:avr:leonardo"
- "arduino:avr:micro"
- "arduino:avr:esplora"
- "arduino:avr:mini"
- "arduino:avr:ethernet"
- "arduino:avr:fio"
- "arduino:avr:bt"
# - "arduino:avr:LilyPad" # board not found
- "arduino:avr:LilyPadUSB"
- "arduino:avr:pro"
- "arduino:avr:atmegang"
- "arduino:avr:robotControl"
# - "arduino:avr:gemma" # does not support SPI
- "arduino:avr:circuitplay32u4cat"
- "arduino:avr:yunmini"
- "arduino:avr:chiwawa"
- "arduino:avr:one"
- "arduino:avr:unowifi"
- "arduino:mbed:nano33ble"
- "arduino:samd:mkr1000"
- "arduino:samd:mkrzero"
- "arduino:samd:mkrwifi1010"
- "arduino:samd:nano_33_iot"
- "arduino:samd:mkrfox1200"
- "arduino:samd:mkrwan1300"
- "arduino:samd:mkrwan1310"
- "arduino:samd:mkrgsm1400"
- "arduino:samd:mkrnb1500"
- "arduino:samd:mkrvidor4000"
- "arduino:samd:adafruit_circuitplayground_m0"
- "arduino:samd:mzero_pro_bl"
- "arduino:samd:mzero_bl"
- "arduino:samd:tian"
- "arduino:megaavr:uno2018"
# - "arduino:megaavr:nano4809" # board not found

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Compile examples
uses: arduino/compile-sketches@main
with:
sketch-paths: |
- examples/Getting_Started_SimpleClient_Mesh
- examples/Getting_Started_SimpleServer_Mesh
- examples/InteractiveServer_Mesh
- examples/MQTT/mqtt_basic
- examples/MQTT/mqtt_basic_2
- examples/SimpleClient_Mesh
- examples/SLIP_Gateway
- examples/SLIP_InteractiveServer
- examples/TAP/Getting_Started_InteractiveServer
- examples/TAP/Getting_Started_SimpleClient
- examples/TAP/Getting_Started_SimpleClient_DNS
- examples/TAP/Getting_Started_SimpleServer
- examples/TAP/Getting_Started_SimpleServer_Minimal
# - examples/TAP/InteractiveServer # specific to AVR boards
# - examples/InteractiveServer_Mesh_ESPWifi # needs ESP8266WiFi.h
libraries: |
- name: RF24
- name: RF24Mesh
- name: RF24Network
- name: PubSubClient
- name: MQTT
- source-path: ./
# - source-url: https://github.com/nRF24/RF24Network.git
# version: CMake-4-Linux
# - source-url: https://github.com/nRF24/RF24Mesh.git
# version: CMake-4-Linux
fqbn: ${{ matrix.fqbn }}
145 changes: 145 additions & 0 deletions .github/workflows/build_platformIO.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: PlatformIO build

on:
pull_request:
types: [opened, reopened]
paths:
- ".github/workflows/build_platformIO.yml"
- "library.json"
- "examples/**"
- "!examples/old_backups/**"
- "!examples/rf24_ATTiny/**"
push:
paths:
- ".github/workflows/build_platformIO.yml"
- "library.json"
- "examples/**"
- "!examples/old_backups/**"
- "!examples/rf24_ATTiny/**"
release:
types: [published, edited]

jobs:
validate_lib_json:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: get latest release version number
id: latest_ver
run: echo "::set-output name=release::$(awk -F "=" '/version/ {print $2}' library.properties)"

- name: Set up Python
uses: actions/setup-python@v2

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: package lib
run: pio package pack -o PlatformIO-RF24Mesh-${{ steps.latest_ver.outputs.release }}.tar.gz

- name: Save artifact
uses: actions/upload-artifact@v2
with:
name: "PIO_pkg_RF24Mesh"
path: PlatformIO*.tar.gz

- name: Upload Release assets
if: github.event_name == 'release'
uses: csexton/release-asset-action@master
with:
pattern: "PlatformIO*.tar.gz"
github-token: ${{ secrets.GITHUB_TOKEN }}

check_formatting:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check code formatting
uses: per1234/artistic-style-action@main
with:
options-file-path: ./examples/examples_formatter.conf
name-patterns: |
- '*.ino'
- '*.cpp'
- '*.hpp'
- '*.h'
target-paths: |
- examples
build:
needs: [check_formatting, validate_lib_json]
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
example:
- "examples/Getting_Started_SimpleClient_Mesh/Getting_Started_SimpleClient_Mesh.ino"
- "examples/Getting_Started_SimpleServer_Mesh/Getting_Started_SimpleServer_Mesh.ino"
- "examples/InteractiveServer_Mesh/InteractiveServer_Mesh.ino"
- "examples/MQTT/mqtt_basic/mqtt_basic.ino"
- "examples/MQTT/mqtt_basic_2/mqtt_basic_2.ino"
- "examples/SimpleClient_Mesh/SimpleClient_Mesh.ino"
- "examples/SLIP_Gateway/SLIP_Gateway.ino"
- "examples/SLIP_InteractiveServer/SLIP_InteractiveServer.ino"
- "examples/TAP/Getting_Started_InteractiveServer/Getting_Started_InteractiveServer.ino"
- "examples/TAP/Getting_Started_SimpleClient/Getting_Started_SimpleClient.ino"
- "examples/TAP/Getting_Started_SimpleClient_DNS/Getting_Started_SimpleClient_DNS.ino"
- "examples/TAP/Getting_Started_SimpleServer/Getting_Started_SimpleServer.ino"
- "examples/TAP/Getting_Started_SimpleServer_Minimal/Getting_Started_SimpleServer_Minimal.ino"
# - "examples/TAP/InteractiveServer/InteractiveServer.ino" # specific to AVR boards
# - "examples/InteractiveServer_Mesh_ESPWifi/InteractiveServer_Mesh_ESPWifi.ino" # requires ESP8266WiFi.h
board:
- "teensy31"
- "teensy35"
- "teensy36"
- "teensy40"
- "teensy41"
- "teensylc"

steps:
- uses: actions/checkout@v2

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v2

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
# "dependencies" field in JSON should automatically install RF24 & RF24Network.
# Because we run this CI test against the local repo, the JSON seems neglected
- name: Install library dependencies
run: |
pio lib -g install nrf24/RF24
pio lib -g install nrf24/RF24Network
pio lib -g install nrf24/RF24Mesh
pio lib -g install knolleary/PubSubClient
pio lib -g install 256dpi/MQTT
- name: Run PlatformIO
run: pio ci --lib="." --board=${{ matrix.board }}
env:
PLATFORMIO_CI_SRC: ${{ matrix.example }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ Temporary Items
# ignore docs folder
docs/html/
docs/xml/

# AStyle formatter bakup files
*.orig
4 changes: 2 additions & 2 deletions RF24Ethernet.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ class RF24EthernetClass {//: public Print {
* this allows users to set custom settings at the radio or network level
*/
#if !defined (RF24_TAP) // Using RF24Mesh
RF24EthernetClass(RF24& _radio,RF24Network& _network, RF24Mesh& _mesh);
RF24EthernetClass(RF24& _radio, RF24Network& _network, RF24Mesh& _mesh);
#else
RF24EthernetClass(RF24& _radio,RF24Network& _network);
RF24EthernetClass(RF24& _radio, RF24Network& _network);
#endif

/** Basic constructor */
Expand Down
Loading

0 comments on commit 518d5fb

Please sign in to comment.