Merge pull request #30 from dmadison/v2 #27
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: build | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
board: ["Arduino Uno", "Arduino Leonardo", "Arduino Mega 2560"] | |
include: | |
- board: "Arduino Uno" # board name, human-readable (matching board array above) | |
platform: "arduino:avr" # board platform, to be installed by the CLI | |
fqbn: "arduino:avr:uno" # fully qualified board name | |
pcint: "true" | |
- board: "Arduino Leonardo" | |
platform: "arduino:avr" | |
fqbn: "arduino:avr:leonardo" | |
pcint: "false" | |
- board: "Arduino Mega 2560" | |
platform: "arduino:avr" | |
fqbn: "arduino:avr:mega:cpu=atmega2560" | |
pcint: "false" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Arduino CLI | |
uses: arduino/[email protected] | |
- name: Install Board Platform | |
run: | | |
arduino-cli core update-index | |
arduino-cli core install ${{ matrix.platform }} | |
- name: Install Extra Libraries | |
run: | | |
arduino-cli lib install Servo | |
arduino-cli lib install PinChangeInterrupt | |
- name: Add Library Symbolic Link to Repo | |
run: | | |
mkdir --parents "$HOME/Arduino/libraries" | |
ln --symbolic "$PWD" "$HOME/Arduino/libraries/." | |
- name: Compile Sketches | |
run: | | |
buildSketchPath() { | |
sktch=${1##*/examples/}; | |
sktch=${sktch%/*.ino}; | |
echo -e "\nBuilding sketch $sktch.ino"; | |
arduino-cli compile --fqbn ${{ matrix.fqbn }} "$1"; | |
} | |
buildExampleSketch() { | |
buildSketchPath "$PWD/examples/$1/$1.ino"; | |
} | |
buildExampleFolder() { | |
IFS=$'\n'; set -f; | |
for f in $(find $PWD/examples/"$1" -name '*.ino'); | |
do | |
buildSketchPath $f; | |
done; | |
unset IFS; set +f; | |
} | |
buildExampleSketch BasicAngle | |
buildExampleSketch Calibration | |
buildExampleSketch Loopback | |
buildExampleSketch RC_Receiver | |
buildExampleSketch Remapping | |
if [ ${{ matrix.pcint }} = "true" ]; then | |
buildExampleFolder PinChangeInt; | |
fi |