diff --git a/HISTORY.rst b/HISTORY.rst index d369f15c..4cba0f05 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,9 +4,12 @@ Release History PlatformIO 2.0 -------------- -2.4.2 (2015-12-??) +2.5.0 (2015-12-??) ~~~~~~~~~~~~~~~~~~ +* Generate `.travis.yml `__ + CI config for embedded projects by default + (`issue #354 `_) * Removed prompt with "auto-uploading" from `platformio init `__ command and added ``--enable-auto-uploading`` option (`issue #352 `_) diff --git a/docs/_static/ci-travis-logo.png b/docs/_static/ci-travis-logo.png new file mode 100644 index 00000000..7a684634 Binary files /dev/null and b/docs/_static/ci-travis-logo.png differ diff --git a/docs/ci/travis.rst b/docs/ci/travis.rst index 691018cf..ad1949ee 100644 --- a/docs/ci/travis.rst +++ b/docs/ci/travis.rst @@ -14,6 +14,13 @@ Travis CI ========= +.. image:: ../_static/ci-travis-logo.png + :target: https://docs.travis-ci.com/user/integration/platformio/ + + +**Travis CI** `officially supports `_ +**PlatformIO for Embedded Builds.** + `Travis CI `_ is an open-source hosted, distributed continuous integration service used to build and test projects hosted at `GitHub `_. diff --git a/platformio/__init__.py b/platformio/__init__.py index 5e23151c..3365b850 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = (2, 4, "2.dev0") +VERSION = (2, 5, "0.dev0") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/init.py b/platformio/commands/init.py index a9ceeb23..c1f64055 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -83,47 +83,8 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 if not isdir(d): makedirs(d) - if not isfile(join(lib_dir, "readme.txt")): - with open(join(lib_dir, "readme.txt"), "w") as f: - f.write(""" -This directory is intended for the project specific (private) libraries. -PlatformIO will compile them to static libraries and link to executable file. - -The source code of each library should be placed in separate directory, like -"lib/private_lib/[here are source files]". - -For example, see how can be organised `Foo` and `Bar` libraries: - -|--lib -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| |--Foo -| | |- Foo.c -| | |- Foo.h -| |- readme.txt --> THIS FILE -|- platformio.ini -|--src - |- main.c - -Then in `src/main.c` you should use: - -#include -#include - -// rest H/C/CPP code - -PlatformIO will find your libraries automatically, configure preprocessor's -include paths and build them. - -See additional options for PlatformIO Library Dependency Finder `lib_*`: - -http://docs.platformio.org/en/latest/projectconf.html#lib-install - -""") + init_lib_readme(lib_dir) + init_ci_conf(project_dir) if not isfile(project_file): copyfile(join(get_source_dir(), "projectconftpl.ini"), @@ -200,3 +161,91 @@ def _install_dependent_platforms(ctx, platforms): cli_platforms_install, platforms=list(set(platforms) - set(installed_platforms)) ) + + +def init_lib_readme(lib_dir): + if isfile(join(lib_dir, "readme.txt")): + return + with open(join(lib_dir, "readme.txt"), "w") as f: + f.write(""" +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organised `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include +#include + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +See additional options for PlatformIO Library Dependency Finder `lib_*`: + +http://docs.platformio.org/en/latest/projectconf.html#lib-install + +""") + + +def init_ci_conf(project_dir): + if isfile(join(project_dir, ".travis.yml")): + return + with open(join(project_dir, ".travis.yml"), "w") as f: + f.write("""# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/en/latest/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/en/latest/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html > +# + +language: python +python: + - "2.7" + +# Cache PlatformIO packages using Travis CI container-based infrastructure +sudo: false +cache: + directories: + - "~/.platformio" + +env: + - PLATFORMIO_CI_SRC=path/to/test/file.c + - PLATFORMIO_CI_SRC=examples/file.ino + - PLATFORMIO_CI_SRC=path/to/test/directory + +install: + - pip install -U platformio + +script: + - platformio ci --board=TYPE_1 --board=TYPE_2 --board=TYPE_N +""")