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

Add Elm documentation #2147

Merged
merged 13 commits into from
Nov 27, 2018
3 changes: 2 additions & 1 deletion _data/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Clojure: "/user/languages/clojure/"
Crystal: "/user/languages/crystal/"
D: "/user/languages/d/"
Dart: "/user/languages/dart/"
Erlang: "/user/languages/erlang/"
Elixir: "/user/languages/elixir/"
Elm: "/user/languages/elm/"
Erlang: "/user/languages/erlang/"
F#: "/user/languages/csharp/"
Go: "/user/languages/go/"
Groovy: "/user/languages/groovy/"
Expand Down
134 changes: 134 additions & 0 deletions user/languages/elm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---
title: Building an Elm Project
layout: en

---

### What This Guide Covers

This guide covers build environment and configuration topics specific to
[Elm](https://elm-lang.org/) projects. Please make sure to read our
[Tutorial](/user/tutorial/) and
[general build configuration](/user/customizing-the-build/) guides first.

<aside markdown="block" class="ataglance">

| Elm | Default |
|:--------------------------------------------|:------------------------------------------|
| [Default `install`](#Dependency-Management) | `npm install` |
| [Default `script`](#Default-Build-Script) | `elm-format --validate . && elm-test` |
| [Matrix keys](#Build-Matrix) | `elm`, `node_js` |
| Support | [Community Support](https://travis-ci.community/c/languages/elm) |

Minimal example:

```yaml
language: elm
elm:
- "0.19.0"
```
{: data-file=".travis.yml"}

</aside>

### 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](https://travis-ci.community/c/languages/elm).

## Choosing Elm versions to test against

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.

```yaml
language: elm
elm:
- elm0.19.0 # default, or equivalently, '0.19.0'
- elm0.18.0
```
{: data-file=".travis.yml"}

### Support tools `elm-test` and `elm-format`

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:

```yaml
language: elm
elm-test: 0.19.0-rev3
elm-format: 0.8.0
```
{: data-file=".travis.yml"}

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.

### Choosing Node.js version to test against

Elm projects may also specify Node.js version, as done for
[Node.js](/user/languages/javascript-with-nodejs/) projects.

```yaml
language: elm
node_js: '10' # latest 10.x
```
{: data-file=".travis.yml"}

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](/user/languages/javascript-with-nodejs/#dependency-management)
for details.

## Default Build Script

The default command for testing Elm projects is:

```bash
elm-format --validate . && elm-test
```

You may override this with `script`:

```yaml
language: elm
script: elm-test
```
{: data-file=".travis.yml"}

## Build Matrix

For Elm projects, `env`, `elm`, and `node_js` can be used as arrays
to construct a build matrix.

## Environment Variables

* The version of Elm a job is using is available as `TRAVIS_ELM_VERSION`.
This defualts to `elm0.19.0`.
* `TRAVIS_ELM_TEST_VERSION` points to the `elm-test` version in use.
If you override `elm-test`, that value is used.
If `elm-test` is not overridden but `elm` is, that value with the `elm`
prefix is used. (For example, `elm: 0.18.0` chooses `[email protected]`.)
If neither `elm-test` nor `elm` is overridden, the default value, `elm0.19.0`
is used.
* `TRAVIS_ELM_FORMAT_VERSION` points to the `elm-format` version in use.
If you override `elm-format`, that value is used.
If `elm-format` is not overridden but `elm` is, that value with the `elm`
prefix is used. (For example, `elm: 0.18.0` chooses `[email protected]`.)
If neither `elm-format` nor `elm` is overridden, the default value, `elm0.19.0`
is used.
* `TRAVIS_NODE_VERSION` points to the `node_js` version in use.