Blend - test your package against different versions of its dependencies

We developed Blend a new hex package that solves the problem of testing your library against different version of its dependencies.

For example, an elixir package that depends on plug_crypto with a requirement of ~> 1.2 or ~> 2.0 , that wants to test against the two major versions, would normally have it’s mix.lock resolved to 2.x .

So there is no straightforward way of running your test locally and in the CI against 1.x and 2.x.

Blend tries to solve this. Inspired in a similar tool that exists in the ruby ecosystem called appraisal

You can create different blends and it will take care of you in generating alternative mix lockfiles and a simple way of running test against them.

Hope you like it!

12 Likes

I only read this post and have few questions:

  1. Do you support different Erlang and Elixir versions as well? (asdf support for example)
  2. Does it only tests code or can it also detect if current project compiles with or without warnings?
  3. By using your package can I detect minimum supported package version and also minimum supported package version excluding soft-deprecate warnings?

I guess that the answer for all is no, but I may be wrong. Anyway, do you think about those points? Are they interesting features to add to your hex package?

1 Like

Hi Eiji,

For example in Github Actions you can achieve 1 and 2 using the matrix feature with blend.

We have been using blend in candlex for testing against different version of nx (0.6 and 0.7 in this case)

Initial implementation and follow up

At the end of the day it would look like this in your CI workflow

      matrix:
         include:
           - elixir_version: 1.16.0
             otp_version: '26.2.1'
             lint: true
           - elixir_version: 1.15.7
             otp_version: '25.3.2.8'
           - elixir_version: 1.15.7
             otp_version: '25.3.2.8'
             blend: "nx06"

You can take a look at the full CI workflow here

2 Likes

Hey Marcelo, thanks for Blend , it’s awesome.

I just merged Surface’s PR and added it to Surface Catalogue

blend/premix.exs is very powerful, I could make custom modifications that Surface Catalogue needed.

Blend makes working with a local copy of Surface simple (BLEND=local mix ...) and fast because each blend has it’s own deps and _build directories.

2 Likes