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

pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New

We're in Beta

About us Mission Statement