Build an Elm Project
This guide covers build environment and configuration topics specific to Elm projects. Please make sure to read our Onboarding and General Build configuration guides first.
Community-Supported Warning #
Travis CI support for Elm is contributed by the community and may be removed or altered at any time. If you run into any problems, please report them in the Travis CI Community Forum.
Test against Elm versions #
You can specify the Elm language versions to test your project against with the
elm
key.
This may be a single string value (e.g., 0.19.0
), or an array of string, in
which case a build matrix consisting of jobs running each of the versions
specified in the array.
language: elm
elm:
- elm0.19.0 # default, or equivalently, '0.19.0'
- elm0.18.0
Elm Support tools #
Elm jobs will also install elm-test
and elm-format
.
By default, these tools correspond to the elm
version specified, with the
prefix elm
.
For example, with elm: 0.19.0
, the version of elm-test
and elm-format
with the tag elm0.19.0
will be installed.
You may also override them with elm-test
and elm-format
keys independently:
language: elm
elm-test: 0.19.0-rev3
elm-format: 0.8.0
Notice that these values are passed to npm
.
This means that they can be specified as a version string (e.g., 0.19.0
)
or a tag (e.g., elm0.19.0
).
elm-test
and elm-format
default to tags with elm
prefix, derived from the
elm
value.
Test against Node.js versions #
Elm projects may also specify Node.js version, as done for Node.js projects.
language: elm
node_js: '10' # latest 10.x
The default Node.js version is 10.13.0
.
Dependency Management #
For dependency management, Elm projects use the same logic as Node.js projects. See Node.js documentation for details.
Environment Variables #
- The version of Elm a job is using is available as
TRAVIS_ELM_VERSION
. This defaults toelm0.19.0
. TRAVIS_ELM_TEST_VERSION
points to theelm-test
version in use. If you overrideelm-test
, that value is used. Ifelm-test
is not overridden butelm
is, that value with theelm
prefix is used. (For example,elm: 0.18.0
chooseselm-test@elm0.18.0
.) If neitherelm-test
norelm
is overridden, the default value,elm0.19.0
is used.TRAVIS_ELM_FORMAT_VERSION
points to theelm-format
version in use. If you overrideelm-format
, that value is used. Ifelm-format
is not overridden butelm
is, that value with theelm
prefix is used. (For example,elm: 0.18.0
chooseselm-format@elm0.18.0
.) If neitherelm-format
norelm
is overridden, the default value,elm0.19.0
is used.TRAVIS_NODE_VERSION
points to thenode_js
version in use.
Build Config Reference #
You can find more information on the build config format for Elm in our Travis CI Build Config Reference.