CI workflows on Tangled for Elixir
Tangled is a Github competitor built on top of atproto. The company behind it is a Finnish startup, situated in Finland, with all servers and data held in the EU. They have taken VC money, but at least conceptually the fact that it's built on top of atproto means that if the strings that came with that cash pull the company in the wrong direction, your data is still yours and you could potentially move it somewhere else. Continuing down my atproto rabbit hole, I spent some time getting a CI workflow set up for https://tangled.org/jola.dev/annot.at. I couldn’t find any examples of Elixir CI workflows for Tangled so it took some experimenting. This uses the new microvm engine that was only recently released, which enables us to run a PostgreSQL service in the workflow. By default it only listens on a unix socket, so we have to set some extra configuration there for it to match the standard Phoenix scaffold setup. when:
- event: ["push", "pull_request"] branch: ["main"]
engine: microvm image: nixos
dependencies:
- beam29Packages.elixir_1_20
- beam29Packages.erlang
services: postgresql: enable: true enableTCPIP: true authentication: | host all all 127.0.0.1/32 trust host all all ::1/128 trust
steps:
- name: setup command: | mix local.hex --force mix local.rebar --force mix deps.get
- name: compile command: mix compile --warnings-as-errors
- name: format command: mix format --check-formatted
- name: credo command: mix credo --strict
- name: test command: mix test --warnings-as-errors
- name: unused command: mix deps.unlock --check-unused
The trickiest part was using specific versions of Elixir and Erlang. You can use dependencies:
- elixir
- erlang
but that gives you an unspecified version of Elixir. It happened to be 1.18 when I tried. Instead, you'll want to find specific NixOS packages to depend on, like the full workflow does. dependencies:
- beam29Packages.elixir_1_20
- beam29Packages.erlang
The BEAM 29 packages I found here https://mynixos.com/nixpkgs/packages/beam29Packages. This still doesn't give me an exact version, but it was close enough for me. I don’t have much experience with NixOS so it was a bit of trial and error to get here, but once I got the config right it runs perfect. Here’s an example run https://tangled.org/jola.dev/annot.at/pipelines/28076/workflow/ci.yml. Now to go figure out how to self-host a knot and a spindle. Don’t have to do that, you can use the servers Tangled offer, but I figure it’s more fun this way.
Discussion in the ATmosphere