From e13b4c71d764cc92a1e5a92f5f2dd1c1f59b4a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 19 Mar 2025 12:27:02 +0100 Subject: Properly handle asdf-installed Elixir --- .github/workflows/ci.yaml | 27 +++++++++++++++++++++++++++ core/elixir.mk | 7 ++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0ff2e4d..2c8c3b6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -119,6 +119,33 @@ jobs: path: | test/test_*/ + check-asdf-elixir: + runs-on: ubuntu-latest + steps: + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Erlang/OTP + uses: erlef/setup-beam@v1 + with: + otp-version: 27 + version-type: loose + + - name: Install asdf along with Elixir + run: | + wget https://github.com/asdf-vm/asdf/releases/download/v0.16.5/asdf-v0.16.5-linux-amd64.tar.gz + tar xf asdf-v*-linux-amd64.tar.gz + ./asdf plugin add elixir + ./asdf install elixir latest + ./asdf set elixir latest + + - name: Install libsodium + run: sudo apt-get -y install libsodium-dev + + - name: Run tests + run: make check c=core-elixir -j4 -k PATH=$PWD:/home/runner/.asdf/shims:$PATH + check-hex: strategy: fail-fast: false diff --git a/core/elixir.mk b/core/elixir.mk index 8d1dba9..eb5c487 100644 --- a/core/elixir.mk +++ b/core/elixir.mk @@ -10,7 +10,12 @@ export ELIXIR ifeq ($(ELIXIR),system) # We expect 'elixir' to be on the path. -ELIXIR_LIBS ?= $(dir $(shell readlink -f `which elixir`))/../lib +ELIXIR_BIN ?= $(shell readlink -f `which elixir`) +ELIXIR_LIBS ?= $(abspath $(dir $(ELIXIR_BIN))/../lib) +# Fallback in case 'elixir' is a shim. +ifeq ($(wildcard $(ELIXIR_LIBS)/elixir/),) +ELIXIR_LIBS = $(abspath $(shell elixir -e 'IO.puts(:code.lib_dir(:elixir))')/../) +endif ELIXIR_LIBS := $(ELIXIR_LIBS) export ELIXIR_LIBS ERL_LIBS := $(ERL_LIBS):$(ELIXIR_LIBS) -- cgit v1.2.3