-
Notifications
You must be signed in to change notification settings - Fork 221
[DO NOT MERGE] Add Github Actions workflow to build library examples #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DO NOT MERGE] Add Github Actions workflow to build library examples #31
Conversation
- name: Compile Examples | ||
run: | | ||
set -x | ||
EXAMPLES=`find examples/ -name *.ino | xargs` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a bit smarter and ignore examples sketches that need contain more than one .ino file ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the cli can accept the folder (and not the file) we can go with find examples/ -name '*.ino' | xargs dirname | uniq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@facchinm @sandeepmistry the cli do accept folders! In #32 you can see the fix I made in the meantime :)
- name: Setup arduino-cli | ||
env: | ||
VERSION: latest | ||
run: | | ||
set -x | ||
wget -P $HOME https://downloads.arduino.cc/arduino-cli/arduino-cli_${VERSION}_Linux_64bit.tar.gz | ||
mkdir $HOME/bin | ||
tar xf $HOME/arduino-cli_${VERSION}_Linux_64bit.tar.gz -C $HOME/bin | ||
echo ::add-path::$HOME/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't use the official setup-arduino-cli github action to remove a bit of boilerplate? In #32 You can see the action working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree on using the official GitHub action. Everything else looks perfectly good to me. Well done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we can slim the GitHub action down? It seems overcomplicated internally (depends on Node.js) etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed the nodejs code gives more flexibility (i.e. pinning only the minor version for the cli) and the chance to leverage other actions code as modules. Additionally the action code is testable with unit testing. KISS is always to prefer, but in case you discover you need something more powerful, we'll be happy to help 😺
run: | | ||
FQBN=${{ matrix.fqbn }} | ||
CORE=`echo "$FQBN" | cut -d':' -f1,2` | ||
echo ::set-env name=FQBN::"$FQBN" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sandeepmistry May I ask also for a small comment explaining each step? In this line it took me a couple of minutes before realizing this is a simple message echo, instead of an obscure bash magic to export the variable :)
Also in https://github.com/arduino-libraries/ArduinoBLE/pull/31/files#diff-3ce900fec73e52de9493561cd47d3a5bR44 would be nice to say why we symlink the folder instead of, for example, moving the library into my sketchbook or something similar.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, will add some comments :)
simple message echo, instead of an obscure bash magic to export the variable :)
it is magic! It's the trick to export env vars to steps: https://help.github.com/en/articles/development-tools-for-github-actions#set-an-environment-variable-set-env
Closing this in favour of #34. |
@facchinm @cmaglie @lxrobotics @mastrolinux @rsora please take a look and provide any feedback you may have.
This will replace: https://github.com/arduino-libraries/ArduinoBLE/blob/master/.travis.yml and will be the base for common actions in
github.com/arduino-libraries/actions
once we are in agreement.I've kept it simple and stuck to using bash as suggested by @rsora. There is some great docs here: https://help.github.com/en/articles/development-tools-for-github-actions