Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions .github/workflows/mise_e2e_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: mise E2E tests
on:
push:
branches: [main]
paths: ['lib']
paths: ['lib', '.github/workflows/mise_e2e_test.yaml']
pull_request:
paths: ['lib']
paths: ['lib', '.github/workflows/mise_e2e_test.yaml']
workflow_dispatch:
schedule:
# Runs at 12am UTC
Expand All @@ -14,6 +14,7 @@ on:
jobs:
mise_e2e_tests:
strategy:
fail-fast: false
matrix:
# ref: https://github.com/actions/runner-images
os: [ubuntu-22.04, macos-latest]
Expand All @@ -34,50 +35,47 @@ jobs:
export PATH="$HOME/.local/bin:$PATH"
mise --version

- name: Add local Elixir plugin for mise E2E
if: runner.os != 'Windows'
run: |
export PATH="$HOME/.local/bin:$PATH"
mise plugins link vfox-elixir-ci "$GITHUB_WORKSPACE"

- name: Install Erlang/OTP & Elixir via mise (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -y
sudo apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-11-jdk
export MAKEFLAGS=-j4
export PATH="$HOME/.local/bin:$PATH"

# Install via mise

mise install vfox:version-fox/vfox-erlang@26.2.3
mise use -g vfox:version-fox/vfox-erlang@26.2.3
eval "$(mise activate bash --shims)"
which erl
echo "===============PATH==============="
echo $PATH
echo "===============PATH==============="

mise install vfox:version-fox/vfox-elixir@1.16.2
mise use -g vfox:version-fox/vfox-elixir@1.16.2
eval "$(mise activate bash --shims)"
eval "$(mise env)"
which erl && which erlc

mise install vfox-elixir-ci@1.16.2
mise use -g vfox-elixir-ci@1.16.2
eval "$(mise env)"
elixirc -v
cd assets
elixir hello.ex


- name: Install Erlang/OTP & Elixir via mise (macOS)
if: runner.os == 'macOS'
run: |
brew install autoconf libxslt fop wxwidgets openssl
export MAKEFLAGS=-j4
export PATH="$HOME/.local/bin:$PATH"

# Install via mise

mise install vfox:version-fox/vfox-erlang@26.2.3
mise use -g vfox:version-fox/vfox-erlang@26.2.3
eval "$(mise activate bash)"
which erl
echo "===============PATH==============="
echo $PATH
echo "===============PATH==============="

mise install vfox:version-fox/vfox-elixir@1.16.2
mise use -g vfox:version-fox/vfox-elixir@1.16.2
eval "$(mise activate bash)"
eval "$(mise env)"
which erl && which erlc

mise install vfox-elixir-ci@1.16.2
mise use -g vfox-elixir-ci@1.16.2
eval "$(mise env)"
elixirc -v
cd assets
elixir hello.ex
7 changes: 6 additions & 1 deletion hooks/post_install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ function PLUGIN:PostInstall(ctx)
elseif os.getenv("VFOX_ELIXIR_MIRROR") == "hex" then
return
else
install_cmd = "cd " .. path .. " && make"
local erlang_bin = elixirUtils.find_erlang_bin()
if erlang_bin then
install_cmd = "cd " .. path .. " && PATH=" .. erlang_bin .. ":$PATH make"
else
install_cmd = "cd " .. path .. " && make"
end
local status = os.execute(install_cmd)
if status ~= 0 then
error("Elixir install failed, please check the stdout for details.")
Expand Down
24 changes: 21 additions & 3 deletions lib/elixir_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,30 @@ function elixir_utils.check_version_existence(url)
end
end

function elixir_utils.find_erlang_bin()
local handle = io.popen("which erlc 2>/dev/null")
local result = handle:read("*l")
handle:close()
if result and result ~= "" then
return result:match("(.+)/")
end
local home = os.getenv("HOME") or ""
local mise_dir = os.getenv("MISE_DATA_DIR") or (home .. "/.local/share/mise")
handle = io.popen("find '" .. mise_dir .. "/installs' -name erlc -type f 2>/dev/null | head -1")
result = handle:read("*l")
handle:close()
if result and result ~= "" then
return result:match("(.+)/")
end
return nil
end

function elixir_utils.check_erlang_existence()
print("Check Erlang/OTP existence...")
local status = os.execute("which erlc")
if status ~= 0 then
error("Please install Erlang/OTP before you install Elixir.")
if elixir_utils.find_erlang_bin() then
return
end
error("Please install Erlang/OTP before you install Elixir.")
end

function elixir_utils.get_elixir_release_verions_in_linux()
Expand Down
3 changes: 3 additions & 0 deletions metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ PLUGIN.license = "Apache 2.0"
PLUGIN.description = "Elixir vfox plugin, support for managing multiple Elixir language versions in Windows & Uinx-like system."


--- Erlang/OTP must be on PATH when compiling Elixir from source.
PLUGIN.depends = { "erlang" }

--- !!! OPTIONAL !!!
--[[
NOTE:
Expand Down
Loading