From 12e625436c53b806ec66552251483755583b0c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 28 Aug 2017 16:35:31 +0200 Subject: Document CI and OTP version management/pinning --- doc/src/guide/book.asciidoc | 2 ++ doc/src/guide/ci.asciidoc | 60 +++++++++++++++++++++++++++++++++-- doc/src/guide/kerl.asciidoc | 76 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 doc/src/guide/kerl.asciidoc diff --git a/doc/src/guide/book.asciidoc b/doc/src/guide/book.asciidoc index 3d1471a..571d06d 100644 --- a/doc/src/guide/book.asciidoc +++ b/doc/src/guide/book.asciidoc @@ -30,6 +30,8 @@ include::sfx.asciidoc[Self-extracting releases] include::escripts.asciidoc[Escripts] +include::kerl.asciidoc[OTP version management] + include::compat.asciidoc[Compatibility with other build tools] [[docs]] diff --git a/doc/src/guide/ci.asciidoc b/doc/src/guide/ci.asciidoc index 24cfc05..0e70001 100644 --- a/doc/src/guide/ci.asciidoc +++ b/doc/src/guide/ci.asciidoc @@ -1,6 +1,62 @@ [[ci]] == Continuous integration -// @todo Write it. +Erlang.mk comes with some support for continuous integration, +aimed at open source projects that need to support more than +one specific Erlang/OTP release. (If you target one specific +release, check the xref:otp_version_pinning[OTP version pinning] +section of the xref:kerl[OTP version management] chapter.) -Placeholder chapter. +=== Configuring Erlang/OTP versions to test + +To use the CI plugin you must first configure which versions +of Erlang/OTP will be used. Erlang.mk provides three separate +configuration variables depending on whether you need a normal +OTP release, a HiPE-enabled release or an ErLLVM-enabled release. + +At the time of writing, this is how you would test against all +the most recent patch releases of Erlang/OTP 19 and above: + +[source,make] +CI_OTP = OTP-19.0.7 OTP-19.1.6 OTP-19.2.3 OTP-19.3.6.2 OTP-20.0.4 + +If you want to test against HiPE and ErLLVM but only with the +latest version of Erlang/OTP, the following could work: + +[source,make] +CI_HIPE = $(lastword $(CI_OTP)) +CI_ERLLVM = $(CI_HIPE) + +Consult the xref:kerl[OTP version management] chapter for more +information about Erlang/OTP versions and customization of the +Erlang/OTP builds. + +=== Running tests across all configured versions + +The recommended way to run the `ci` target is with the option +`-k`. It will ensure that tests are run for all configured +Erlang/OTP versions, even if there are errors: + +[source,bash] +$ make ci -k + +=== Extending the CI targets + +The `ci` target can be extended. For example to run Dialyzer +at the end of CI: + +[source,make] +ci:: dialyze + +Additional setup can be done by extending the `ci-setup` +target. This target is ran before testing each individual +Erlang/OTP version. + +For example, to ensure dependencies are re-fetched/built +before testing individual Erlang/OTP releases: + +[source,make] +ci-setup:: distclean + +Similarly, the `ci-extra` target can be extended to run +extra commands after an Erlang/OTP version has been tested. diff --git a/doc/src/guide/kerl.asciidoc b/doc/src/guide/kerl.asciidoc new file mode 100644 index 0000000..c557d43 --- /dev/null +++ b/doc/src/guide/kerl.asciidoc @@ -0,0 +1,76 @@ +[[kerl]] +== OTP version management + +Erlang.mk comes with integrated support for +https://github.com/kerl/kerl[Kerl], a shell script that +automates the downloading, building and installing of +Erlang/OTP. It can be used to easily build a specific +Erlang/OTP version (with or without custom build options) +or maintain different versions side by side. + +=== Erlang versions + +Erlang.mk uses the Git tags from Erlang/OTP to identify +OTP versions. The most recent tag at the time of writing +is `OTP-20.0.4`, which is a patch release of `OTP-20.0`. +A patch release is a non-official release containing a +few fixes on top of the official release. + +Older versions used a slightly different versioning scheme +and tag format, for example: `OTP_R16B03`. Beware though, +there also was an `OTP_R16B03-1` release that fixed a +critical issue in the initial release. + +The README file for all official Erlang/OTP releases can +be found on http://www.erlang.org/downloads[erlang.org]. +To obtain information about patch releases when they are +released you need to be subscribed to the +http://erlang.org/mailman/listinfo/erlang-questions[erlang-questions mailing list]. + +[[otp_version_pinning]] +=== OTP version pinning + +Erlang.mk can use a specific version of Erlang/OTP when +interacting with your project. This can be very useful +when you are working with a team because you can define +the version you need in the Makefile and Erlang.mk will +ensure this version is used by everyone in your team. + +To pin the version all you need to do is to set the +`ERLANG_OTP` variable in your Makefile before including +Erlang.mk. For example, to use `OTP-20.0.4`: + +[source,make] +---- +ERLANG_OTP = OTP-20.0.4 + +include erlang.mk +---- + +The next time you run `make` Erlang.mk will build and +use the version you configured. + +Note that there has been reports that this functionality +is not compatible with the `.ONESHELL` feature from +GNU Make. + +=== Continuous integration + +Erlang.mk can automatically test your project against +many different Erlang/OTP versions. This functionality +is documented in the xref:ci[Continuous integration] chapter. + +=== Configuring Kerl + +All of the Kerl variables can be configured directly in the +Makefile. All you need to do is to export them. For example, +to change the installation directory for the Erlang/OTP +versions managed by Kerl, you could add the following to +your Makefile: + +[source,make] +export KERL_INSTALL_DIR = $(CURDIR)/erlang + +When configuring paths like this, always make sure to provide +an absolute path in the value. Erlang.mk will NOT expand them +automatically for you. -- cgit v1.2.3