{"id":21931423,"url":"https://github.com/mimiquate/blend","last_synced_at":"2025-04-04T11:10:43.311Z","repository":{"id":221230855,"uuid":"750485995","full_name":"mimiquate/blend","owner":"mimiquate","description":"🥣 Test your package against different versions of its dependencies","archived":false,"fork":false,"pushed_at":"2025-03-25T13:45:59.000Z","size":124,"stargazers_count":79,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T10:05:58.357Z","etag":null,"topics":["dependencies","elixir","mix","testing"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/blend","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mimiquate.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-30T18:26:51.000Z","updated_at":"2025-03-28T08:27:39.000Z","dependencies_parsed_at":"2024-02-22T16:28:14.795Z","dependency_job_id":"f0c08f9f-2000-4706-8584-a91bde9365d9","html_url":"https://github.com/mimiquate/blend","commit_stats":{"total_commits":75,"total_committers":5,"mean_commits":15.0,"dds":"0.17333333333333334","last_synced_commit":"0add994397bb326297613c96cd54304abd14320c"},"previous_names":["mimiquate/blend"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mimiquate%2Fblend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mimiquate%2Fblend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mimiquate%2Fblend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mimiquate%2Fblend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mimiquate","download_url":"https://codeload.github.com/mimiquate/blend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166168,"owners_count":20894654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependencies","elixir","mix","testing"],"created_at":"2024-11-28T23:13:52.317Z","updated_at":"2025-04-04T11:10:43.294Z","avatar_url":"https://github.com/mimiquate.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🥣 Blend\n\n[![ci](https://github.com/mimiquate/blend/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mimiquate/blend/actions?query=branch%3Amain)\n[![Hex.pm](https://img.shields.io/hexpm/v/blend.svg)](https://hex.pm/packages/blend)\n[![Docs](https://img.shields.io/badge/docs-gray.svg)](https://hexdocs.pm/blend)\n\nTest your package against different versions of its dependencies.\n\nGenerates and maintains multiple lockfiles based on your defined variations (a.k.a. blends)\nso that you can test your package against different variations of your dependencies versions.\n\nYou can read more about the motivation for this project [here](#Motivation).\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `blend` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:blend, \"~\u003e 0.5.0\", only: :dev}\n  ]\nend\n```\n\n## Usage\n\n### 1. Generate `blend.exs`\n\n```\nmix blend.install\n```\n\n### 2. Define your blends\n\nEdit and set your blends in the `blend.exs` file.\n\nFor example, an elixir package that depends on `plug_crypto` with a requirement of `~\u003e 1.2 or ~\u003e 2.0`,\nthat wants to test against the two major versions, would normally have it's `mix.lock` resolved to\n`2.x`, so it would want to define the following:\n\n```elixir\n# blend.exs\n\n# Example for testing against plug_crypto 1.x\n%{\n  plug_crypto_1: [{:plug_crypto, \"~\u003e 1.2\"}]\n}\n```\n\nin order for blend to generate an additional lockfile that locks `plug_crypto` to the latest possible\n`1.x` supported version.\n\nMap keys define the blend name, used for naming the lockfile, and the dependencies list are\nmerged with the package dependencies before resolving and generating the lockfile variation.\n\n### 3. Resolve blends and generate lockfiles\n\n```\nmix blend.get\n```\n\nto resolve your blends and generate new lockfiles with variations of your dependencies under the new `/blend` folder.\n\n```\nblend\n├── plug_crypto_1\n│   ├── _build\n│   ├── deps\n│   └── mix.lock\nmix.lock\n```\n\n### 4. Ignore blend build artifacts\n\n```diff\n # .gitignore\n\n ...\n\n+/blend/*/_build\n+/blend/*/deps\n```\n\nAdd to your `.gitignore` file, before comitting your changes.\n\n\n### 5. Running tasks in the context of a blend lockfile\n\n#### Option A. Overriding your `mix.lock`.\n\nIf you just need to quickly run against a blend lockfile (e.g. in a CI job step), it might be enough to just:\n\n```\ncp blend/plug_crypto_1/mix.lock mix.lock\n```\n\nbefore your `mix deps.get` step.\n\nAfter that you can run any additional task, e.g. run your tests or your phx.server, which will run in the context\nof the specific blend lockfile copied.\n\n```sh\nmix test\n```\n\nor\n\n```sh\nmix phx.server\n```\n\n#### Option B. `BLEND` env var configuration\n\nA more permanent configuration for running mix tasks in the context of a blend lockfile with a simple env var\ncan be accomplished by customizing your `mix.exs` a bit, with the following steps.\n\n##### 1. Create a new file `blend/premix.exs` with the following command:\n\n```\nmix blend.gen.premix\n```\n\nThis will generate a `blend/premix.exs` file that needs to be compiled at the top of your `mix.exs` file\nso that some mix env vars are properly set based on the `BLEND` env var before running any mix task.\n\n##### 2. Modify your `mix.exs`.\n\n```diff\n # mix.exs\n\n+if File.exists?(\"blend/premix.exs\") do\n+  Code.compile_file(\"blend/premix.exs\")\n+end\n\n defmodule YourApp.MixProject do\n   ...\n   def project do\n     [\n       ...\n     ]\n+    |\u003e Keyword.merge(maybe_lockfile_option())\n   end\n   ....\n\n+  defp maybe_lockfile_option do\n+    case System.get_env(\"MIX_LOCKFILE\") do\n+      nil -\u003e []\n+      \"\" -\u003e []\n+      lockfile -\u003e [lockfile: lockfile]\n+     end\n+  end\n end\n```\n\n##### 3. Enjoy\n\nNow you can run any task, e.g. run your tests or your server, against different lockfiles locally by just\nprepending the proper environment variable value:\n\n```sh\nBLEND=plug_crypto_1 mix test\n```\n\nor\n\n```sh\nBLEND=plug_crypto_1 mix phx.server\n```\n\n## Tasks\n\n```\nmix blend.install         # Generate blend.exs\nmix blend.get             # Generate blend lockfiles\nmix blend.update --all    # Update blend lockfiles to latest possible versions\nmix blend.unlock --unused # Clean unused dependencies in blend lockfiles\nmix blend.list            # List blends\nmix blend.clean           # Cleans blends build artifacts and stale lockfiles\nmix blend.gen.premix      # Generate premix.exs file\n```\n\n\n## Motivation\n\nAt Mimiquate, our engagement with the Elixir ecosystem deeply influences our projects. We’ve benefited immensely from the community’s support and resources. During our development of open-source hex packages, we encountered a challenge: testing across different dependency versions lacked a straightforward approach. This issue led us to think about how we could contribute to the community that has been so supportive of us.\n\nOur background includes Ruby on Rails, where the Ruby community has tackled a similar challenge with the appraisal gem. This tool makes it easier to test various dependency versions and is designed to work well with CI pipelines, reducing the risk of regressions. It’s been really great for developers and has positively impacted the ecosystem’s health.\n\nWith that inspiration, we set out to create something for the Elixir community to help streamline development. Our first version doesn’t have all the functionalities of the appraisal gem but establishes a good starting point. It allows developers to test their hex packages against different lock file combinations, which is handy for spotting regressions in common scenarios.\n\nWe realize that our current tool doesn’t address every testing scenario. Yet, we’re committed to improving it, aiming to cover more ground and enhance its functionality. Our goal goes beyond just solving a technical issue; we hope to make the development process in the Elixir community more supportive and efficient for everyone.\n\n## Having a hard time finding Elixir talent?\n\nAt Mimiquate we have been Elixiring since 2016 and we are true believers in the community and the ecosystem.\nIf you are looking to turbo charge your Elixir team, [reach out](mailto:contact@mimiquate.com?subject=Elixir%20team%20augmentation)!\n\n## License\n\nCopyright 2024 Mimiquate\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmimiquate%2Fblend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmimiquate%2Fblend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmimiquate%2Fblend/lists"}