Skip to content
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

PlatformIO as Continuous Integration tool for embedded projects #108

Closed
ivankravets opened this issue Mar 3, 2015 · 6 comments
Closed
Assignees
Milestone

Comments

@ivankravets
Copy link
Member

Aims

PlatformIO is #1 tool for "Cloud Compiling" now. The one missing feature is to allow each developer/script to use PlatformIO in "Continuous Integration" manner. PlatformIO can build embedded projects for the different development platforms (Atmel AVR, Atmel SAM, TI MSP430, TI TIVA, Teensy, (soon Freescale FRDM, NXP LPC, Nordic RF51), frameworks (Arduino, mbed, libopencm3), and etc).

Requirements

The main aim is to promote PlatformIO as tool which is the best for "Continuous Integration". It should allow to specify src files, lib directories and boards which PlatformIO should use for running.

Implementation

It should be implemented via the new command platformio ci [OPTIONS] SRC where:

  • SRC is the list with source files/dirs.They should be copied to src directory in new PlatformIO based project.

Options:

  • -l, --lib the list with source code of libraries which should be copied to lib directory of PlatformIO project.
  • -b, --board the list with boards. All tests should be passed over them.

NOTE
src, --lib and --board can be MULTIPLE. GLOB syntax should by allowed.

Using

For example, let's use this project https://github.com/felis/USB_Host_Shield_2.0. We want to test PS3SPP.ino example with the different boards/platforms:

# clone repo and change directory to it
platformio ci --lib="." --board=uno --board=teensy31 --board=due examples/Bluetooth/PS3SPP/PS3SPP.ino

Travis CI

Yep :) PlatformIO could be the best friend of @travis-ci. Example of .travis.yml:

language: python
python:
    - "2.7"

env:
    - PLATFORMIO_CI_SRC=examples/Bluetooth/PS3SPP/PS3SPP.ino
    - PLATFORMIO_CI_SRC=examples/pl2303/pl2303_gps/pl2303_gps.ino

install:
    - python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"

script:
    - platformio ci --lib="." --board=uno --board=teensy31 --board=due 

We have already implemented a lot of these things... See how does testing work with PlatformIO Examples via Travis CI:
https://travis-ci.org/ivankravets/platformio/jobs/52805475


Friends @valeros, @aphelps, @robertinant, @PaulStoffregen, @aethaniel, @xxxajk, @Lauszus, @pelikhan, @ncolomer, @bettabacon, @eiginn, @Informatic, @mac7, @manashmndl, @MrCustomizer, @franciscoruiz, @elyulka

What do you think about it?

@pelikhan
Copy link

pelikhan commented Mar 4, 2015

  • What about those prompts? They are complete show stopper right now.
  • Travis support sounds great however it should limited to it. There are many other build systems.
  • Travis supports a feature to cache certain folders, like npm-modules. You should update your example: installing a complete platformio drop on every build might quickly turn out costly for you.

Sent from Outlookhttp://taps.io/outlookmobile

On Tue, Mar 3, 2015 at 2:51 PM -0800, "Ivan Kravets" <notifications@github.commailto:notifications@github.com> wrote:

Aims

PlatformIO is #1#1 tool for "Cloud Compiling" now. The one missing feature is to allow each developer/script to use PlatformIO in "Continuous Integration" manner. PlatformIO can build embedded projects for the different development platforms (Atmel AVR, Atmel SAM, TI MSP430, TI TIVA, Teensy, (soon Freescale FRDM, NXP LPC, Nordic RF51) and etc).

Requirements

The main aim is to promote PlatformIO as tool which is the best for "Continuous Integration". It should allow to specify src files, lib directories and boards which PlatformIO should use for running.

Implementation

It should be implemented via the new command platformio ci with the next options:

  • -s, --src the list with source files/dirs.They should be copied to src directory in new PlatformIO based project.
  • -l, --lib the list with source code of libraries which should be copied to lib directory of PlatformIO project.
  • -b, --board the list with boards. All tests should be passed over them.

NOTE
--src and --lib can be MULTIPLE. GLOBhttp://en.wikipedia.org/wiki/Glob_(programming) syntax should by allowed.

Using

For example, let's use this project https://github.com/felis/USB_Host_Shield_2.0. We want to test a few examples with the different boards/platforms:

clone repo and change directory to it

platformio ci --src="examples/Bluetooth/PS3SPP/PS3SPP.ino" --lib="." --board=uno --board=teensy31 --board=due

Travis CI

Yep :) PlatformIO could be the best friend of @travis-cihttps://github.com/travis-ci. Example of .travis.yml:

language: python
python:
- "2.7"

install:
- python -c "$(curl -fsSL https://raw.githubusercontent.com/ivankravets/platformio/master/scripts/get-platformio.py)"

script:
- platformio ci --src="examples/Bluetooth/PS3SPP/PS3SPP.ino" --lib="." --board=uno --board=teensy31 --board=due
- platformio ci --src="examples/pl2303/pl2303_gps/pl2303_gps.ino" --lib="." --board=megaatmega2560

... and etc


We have already implemented a lot of these things... See how does testing work with PlatformIO Exampleshttps://github.com/ivankravets/platformio/tree/develop/examples via Travis CI:
https://travis-ci.org/ivankravets/platformio/jobs/52805475


Friends @valeroshttps://github.com/valeros, @aphelpshttps://github.com/aphelps, @robertinanthttps://github.com/robertinant, @PaulStoffregenhttps://github.com/PaulStoffregen, @aethanielhttps://github.com/aethaniel, @xxxajkhttps://github.com/xxxajk, @Lauszushttps://github.com/Lauszus, @pelikhanhttps://github.com/pelikhan, @ncolomerhttps://github.com/ncolomer, @bettabaconhttps://github.com/bettabacon, @eiginnhttps://github.com/eiginn, @Informatichttps://github.com/Informatic, @mac7https://github.com/mac7, @manashmndl<https://gi
%20thub.com/manashmndl>, @MrCustomizerhttps://github.com/MrCustomizer, @franciscoruizhttps://github.com/franciscoruiz, @elyulkahttps://github.com/elyulka

What do you think about it?

Reply to this email directly or view it on GitHubhttps://github.com//issues/108.

@aphelps
Copy link

aphelps commented Mar 4, 2015

What's the advantage of this new command to just using 'platformio run' with appropriate options?

@ivankravets ivankravets modified the milestones: 1.2.0, 1.3.0 Mar 5, 2015
@ivankravets
Copy link
Member Author

Dear @pelikhan ,

What about those prompts? They are complete show stopper right now.

There are a few options to disable prompts:

Travis support sounds great however it should limited to it. There are many other build systems.

Which others systems you could propose?

Travis supports a feature to cache certain folders, like npm-modules. You should update your example: installing a complete platformio drop on every build might quickly turn out costly for you.

@travis-ci doesn't allow to cache "something" for free account. This feature is available only for the premium accounts.

@ivankravets
Copy link
Member Author

Dear @aphelps,

What's the advantage of this new command to just using 'platformio run' with appropriate options?

platformio ci command will consist from init + source/libs GLOB finder + run commands. This command is useful for the projects which want to be tested under different embedded platforms, but don't want to keep project structure in PlatformIO style. The simple example is Arduino library. The most libs like to keep in root of repository "library source code" and test code in "examples" folder.

Therefore, developers of libraries can add the only single .travis.yml or circle.yml file to repo and PlatformIO will test all examples. Another way is to dynamically perform "bash" commands with platformio init + cp files + platformio run.

If you like to keep your project in PlatformIO compatible structure, then you can use "platformio run" command for Continuous Integration systems.

@pelikhan
Copy link

pelikhan commented Mar 5, 2015

Jenkins is another one.

Sent from Outlookhttp://taps.io/outlookmobile

On Thu, Mar 5, 2015 at 1:32 PM -0800, "Ivan Kravets" <notifications@github.commailto:notifications@github.com> wrote:

Dear @pelikhanhttps://github.com/pelikhan ,

What about those prompts? They are complete show stopper right now.

There are a few options to disable prompts:

  • using environment variable PLATFORMIO_SETTING_ENABLE_PROMPTS=Nohttp://docs.platformio.org/en/latest/envvars.html#envvar-platformio-setting-enable-prompts
  • disable global setting enable_prompts via platformio settings commandhttp://docs.platformio.org/en/latest/userguide/cmd_settings.html#cmd-settings
  • masking under Continuous Integration system via environment variable CI=truehttp://docs.platformio.org/en/latest/envvars.html#envvar-ci.

Travis support sounds great however it should limited to it. There are many other build systems.

Which others systems you could propose?

Travis supports a feature to cache certain folders, like npm-modules. You should update your example: installing a complete platformio drop on every build might quickly turn out costly for you.

@travis-cihttps://github.com/travis-ci doesn't allow to cache "something" for free account. This feature is available only for the premium accounts.

Reply to this email directly or view it on GitHubhttps://github.com//issues/108#issuecomment-77456433.

@aphelps
Copy link

aphelps commented Mar 6, 2015

Yeah, Jenkins is what I typically use for more serious projects.

Also, thanks for the clarification on what all 'platformio ci' will be doing, that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants