victorolinasc

victorolinasc

Running ExDoc on CI for both Elixir 1.6 and 1.7

ex_doc is playing some jokes on me…

I have a library that I’d like to test on CI with Elixir 1.7 and OTP21. BUT I’d also like to test against OTP20 and Elixir 1.6. The thing is: I usually build the docs on CI just to confirm I haven’t broken anything there.

Currently, I either disable doc building on CI or I don’t test with latest versions. Is there something I can do on this scenario? And if there is not, shouldn’t the version bump be major?

Anyway, the docs are way nicer on 0.19. Thanks for all the work invested there.

Marked As Solved

lackac

lackac

It’s a bit tricky, but it’s possible to do this. However, before I get to that I wanted to note that according to SemVer spec 2.0 0.x.y versions do not come with any compatibility guarantees.

ExDoc version requirement based on Elixir version

One option would be to determine the ExDoc version requirement based on the current Elixir version:

  defp deps do
    [
      {:ex_doc, ex_doc_version(), only: :dev, runtime: false}
    ]
  end

  defp ex_doc_version do
    if System.version() >= "1.7", do: "~> 0.19", else: "~> 0.18.0"
  end

The drawback of this approach is that you now have an inconsistent mix.lock file between different Elixir versions. This might not be a problem if you primarily work with 1.7 and just want to include 1.6 on CI.

Use ExDoc 0.18 from escript

Another approach would be to stick to "~> 0.19" in your deps and use the older version from an escript install. On your CI if it’s running with 1.6 you would need something like this to generate the docs:

$ mix escript.install hex ex_doc '~> 0.18.0'
$ mix compile # there will be some warnings relating to ex_doc 0.19, but those can be ignored
$ path/to/escripts/ex_doc YourProject 0.1.0 _build/dev/lib/your_project/ebin -m YourProject

I prefer this approach because it avoids the mix.lock inconsistency and restricts the necessary changes to your CI configuration.

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127089 1222
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement