-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to github action v2 Updated the action to use the action.yml file and input parameter. Updated Readme to show new workflow syntax. Added hardware input parameter
- Loading branch information
Showing
4 changed files
with
76 additions
and
45 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
FROM hexeo/arduino-builder | ||
|
||
LABEL "com.github.actions.name"="Run arduino-builder" | ||
LABEL "com.github.actions.description"="Run the arduino-builder for all sketches and see if they compile" | ||
LABEL "com.github.actions.icon"="server" | ||
LABEL "com.github.actions.color"="blue" | ||
|
||
LABEL "repository"="https://github.com/Legion2/arduino-builder-action" | ||
|
||
ADD entrypoint.sh /entrypoint.sh | ||
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,27 +3,31 @@ Github Action to run arduino-builder for sketches and see if they compile. | |
Used Arduino IDE version is `1.8.3`. | ||
|
||
## Usage | ||
``` | ||
action "Build examples" { | ||
uses = "Legion2/arduino-builder-action@master" | ||
env = { | ||
BOARD_NAME = "arduino:avr:leonardo" | ||
} | ||
} | ||
See [action.yml](action.yml) for comprehensive list of parameters. | ||
|
||
Basic: | ||
```yaml | ||
name: Build examples | ||
on: push | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Build all example sketches | ||
uses: Legion2/[email protected] | ||
with: | ||
board: "arduino:avr:leonardo" | ||
``` | ||
### Arguments | ||
Specified arguments override any default arguments passed to arduino-builder, with the exception of the sketch parameter. | ||
The default arguments set all mandatory parameters. | ||
Use the [Environment variables](#environment-variables) to change some of the parameters. | ||
Specified arguments override any input parameters passed to arduino-builder, with the exception of the sketch input parameter. | ||
Only use arguments if the input parameters don't provide the feature you need. | ||
See the the [action.yml](action.yml) for comprehensive list of input parameters. | ||
### Environment variables | ||
* **`SKETCH_PATH`** *(optional)* : Path to a single sketch | ||
* **`SKETCH_DIRECTORY_PATH`** *(optional)* : Directory in which to search for sketches (default: `examples/`) | ||
* **`BOARD_NAME`** *(optional)* : Fully Qualified Board Name (default: `arduino:avr:uno`) | ||
* **`LIBRARIES_PATH`** *(optional)* : Folder containing Arduino libraries. | ||
Use this folder to install required 3rd-party libraries. | ||
Libraries SHOULD be installed by a parent action e.g. [Download GitHub Release](https://github.com/marketplace/actions/download-github-release) (default: `libraries/`) | ||
### Install Libraries | ||
Libraries SHOULD be installed by a previous step in the job in `libraries/`. | ||
You can use [Download GitHub Release Action](https://github.com/marketplace/actions/download-github-release) to install a library form a GitHub Release. | ||
|
||
## License | ||
The Dockerfile and associated scripts and documentation in this project are released under the [Apache-2.0 License](LICENSE). |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: 'Run arduino-builder' | ||
description: 'Run the arduino-builder for all sketches and see if they compile' | ||
author: 'Leon Kiefer' | ||
inputs: | ||
sketch: | ||
description: 'Path to a single sketch' | ||
required: false | ||
sketchDirectory: | ||
description: 'Directory in which to search for sketches' | ||
default: 'examples' | ||
board: | ||
description: 'Fully Qualified Board Name' | ||
default: 'arduino:avr:uno' | ||
libraries: | ||
description: | | ||
Directory containing Arduino libraries. | ||
Use this directory to install required 3rd-party libraries. | ||
default: 'libraries' | ||
hardware: | ||
description: 'Directory containing Arduino platforms' | ||
default: 'hardware' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
branding: | ||
icon: 'server' | ||
color: 'blue' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,44 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ -z "$BOARD_NAME" ]; then | ||
BOARD_NAME="arduino:avr:uno" | ||
BUILDER_PATH="/opt/arduino" | ||
LIBRARIES_PATH="$BUILDER_PATH/libraries:$GITHUB_WORKSPACE/../" | ||
|
||
SKETCH_PATH="$INPUT_SKETCH" | ||
BOARD_NAME="$INPUT_BOARD" | ||
SKETCH_DIRECTORY_PATH="$INPUT_SKETCHDIRECTORY" | ||
|
||
if [ -d "$INPUT_LIBRARIES" ]; then | ||
LIBRARIES_PATH="$LIBRARIES_PATH:$INPUT_LIBRARIES" | ||
fi | ||
|
||
if [ -z "$LIBRARIES_PATH" ]; then | ||
LIBRARIES_PATH="${GITHUB_WORKSPACE}/libraries/" | ||
if [ ! -d "$LIBRARIES_PATH" ]; then | ||
LIBRARIES_PATH=$GITHUB_WORKSPACE | ||
fi | ||
getLibraryOptions() { | ||
local IFS=":" | ||
for library in $1 | ||
do | ||
echo -n " -libraries $library" | ||
done | ||
} | ||
|
||
BUILDER_OPTIONS="-hardware $BUILDER_PATH/hardware -tools $BUILDER_PATH/hardware/tools/avr -tools $BUILDER_PATH/tools-builder `getLibraryOptions $LIBRARIES_PATH` -fqbn $BOARD_NAME" | ||
|
||
if [ -d "$INPUT_HARDWARE" ]; then | ||
BUILDER_OPTIONS="$BUILDER_OPTIONS -hardware $INPUT_HARDWARE" | ||
fi | ||
|
||
if [ ! -z "$SKETCH_PATH" ]; then | ||
SKETCH_PATH=$(readlink -f "$SKETCH_PATH") | ||
cd /opt/arduino | ||
if [ -n "$SKETCH_PATH" ]; then | ||
if [ -z "$1" ]; then | ||
./arduino-builder -hardware ./hardware -tools ./hardware/tools/avr -tools ./tools-builder -libraries ./libraries -libraries $LIBRARIES_PATH -libraries $GITHUB_WORKSPACE/../ -fqbn $BOARD_NAME "$SKETCH_PATH" | ||
arduino-builder $BUILDER_OPTIONS "$SKETCH_PATH" | ||
else | ||
./arduino-builder "$@" "$SKETCH_PATH" | ||
arduino-builder "$@" "$SKETCH_PATH" | ||
fi | ||
else | ||
if [ -z "$SKETCH_DIRECTORY_PATH" ]; then | ||
SKETCH_DIRECTORY_PATH="${GITHUB_WORKSPACE}/examples/" | ||
fi | ||
|
||
cd /opt/arduino | ||
for sketch in `find "${SKETCH_DIRECTORY_PATH}" -name '*.ino'` | ||
for sketch in `find "$SKETCH_DIRECTORY_PATH" -name '*.ino'` | ||
do | ||
if [ -z "$1" ]; then | ||
./arduino-builder -hardware ./hardware -tools ./hardware/tools/avr -tools ./tools-builder -libraries ./libraries -libraries $LIBRARIES_PATH -libraries $GITHUB_WORKSPACE/../ -fqbn $BOARD_NAME $sketch | ||
arduino-builder $BUILDER_OPTIONS "$sketch" | ||
else | ||
./arduino-builder "$@" $sketch | ||
arduino-builder "$@" "$sketch" | ||
fi | ||
done | ||
fi |