Merge pull request #18 from dmadison/actions #54
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 | |
env: | |
BOARD: "Arduino Leonardo" # board name, human-readable | |
BOARD_PLATFORM: "arduino:avr" # board platform, to be installed by the CLI | |
BOARD_FQBN: "arduino:avr:leonardo" # fully qualified board name for compilation | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Arduino CLI | |
uses: arduino/setup-arduino-cli@v1.1.2 | |
- name: Install Board Platform | |
run: | | |
arduino-cli core update-index | |
arduino-cli core install $BOARD_PLATFORM | |
- name: Add Library Symbolic Link to Repo | |
run: | | |
mkdir --parents "$HOME/Arduino/libraries" | |
ln --symbolic "$PWD" "$HOME/Arduino/libraries/." | |
- name: Install Dependencies | |
run: | | |
git clone https://github.com/MHeironimus/ArduinoJoystickLibrary $HOME/Arduino/libraries/Joystick | |
- name: Compile Library Examples | |
run: | | |
buildSketchPath() { | |
sktch=${1##*/examples/}; | |
sktch=${sktch%/*.ino}; | |
echo -e "\nBuilding sketch $sktch.ino"; | |
arduino-cli compile --fqbn $BOARD_FQBN "$1"; | |
} | |
buildExamples() { | |
IFS=$'\n'; set -f; | |
for f in $(find $PWD/examples/ -name '*.ino'); | |
do | |
buildSketchPath $f; | |
done; | |
unset IFS; set +f; | |
} | |
buildExamples |