generated from version-fox/vfox-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support install Erlang/OTP in windows (#3)
* feat: support install Erlang/OTP in windows * chore: update e2e test for windows * chore: e2e push only trigger in main branch * docs: update README
- Loading branch information
Showing
7 changed files
with
108 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,15 @@ name: E2E tests | |
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
e2e_tests: | ||
strategy: | ||
matrix: | ||
# ref: https://github.com/actions/runner-images | ||
os: [ubuntu-20.04, macos-13] | ||
os: [ubuntu-20.04, macos-13, windows-2022] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -27,10 +28,25 @@ jobs: | |
run: | | ||
brew tap version-fox/tap | ||
brew install vfox | ||
- name: add vfox-erlang plugin | ||
- name: install scoop (Windows) | ||
if: runner.os == 'Windows' | ||
uses: MinoruSekine/setup-scoop@v3 | ||
|
||
- name: install vfox (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
scoop install vfox | ||
- name: add vfox-erlang plugin (Unix-like) | ||
if: runner.os != 'Windows' | ||
run: | | ||
vfox add --source https://github.com/version-fox/vfox-erlang/archive/${GITHUB_REF}.zip erlang | ||
- name: add vfox-erlang plugin (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
vfox add --source https://github.com/version-fox/vfox-erlang/archive/refs/heads/main.zip erlang | ||
vfox add --source https://github.com/version-fox/vfox-erlang/archive/$env:GITHUB_REF.zip erlang | ||
- name: install Erlang/OTP by vfox-erlang plugin (Linux) | ||
if: runner.os == 'Linux' | ||
|
@@ -58,4 +74,15 @@ jobs: | |
echo "===============PATH===============" | ||
cd assets | ||
erlc hello.erl | ||
erl -noshell -s hello hello_world -s init stop | ||
erl -noshell -s hello hello_world -s init stop | ||
- name: install etcd by vfox-etcd plugin (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
vfox install [email protected] | ||
vfox use [email protected] | ||
Invoke-Expression "$(vfox activate pwsh)" | ||
echo "===============PATH===============" | ||
echo $env:PATH | ||
echo "===============PATH===============" | ||
& erl.exe -eval 'erlang:display({otp_release, erlang:system_info(otp_release)}), halt().' -noshell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
.tool-versions | ||
*.beam | ||
*.beam | ||
available.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
# vfox-erlang plugin | ||
|
||
Erlang/OTP [vfox](https://github.com/version-fox) plugin. Use the vfox to manage multiple [Erlang/OTP](https://www.erlang.org/) versions in Linux/Darwin. | ||
Erlang/OTP [vfox](https://github.com/version-fox) plugin. Use the vfox to manage multiple [Erlang/OTP](https://www.erlang.org/) versions in Linux/Darwin MacOS/Windows. all platform~ | ||
|
||
## Usage | ||
|
||
|
@@ -22,7 +22,7 @@ vofx search erlang | |
vfox install [email protected] | ||
``` | ||
|
||
## Before install Erlang/OTP | ||
## Before install Erlang/OTP in Linux/Darwin MacOS | ||
|
||
vfox-erlang plugin would install Erlang/OTP through the [Erlang/OTP](https://www.erlang.org/doc/installation_guide/install#how-to-build-and-install-erlang-otp) source code compilation. So you must have the utilities mentioned in the document -> [Building and Installing Erlang/OTP](https://www.erlang.org/doc/installation_guide/install#how-to-build-and-install-erlang-otp). | ||
|
||
|
@@ -46,7 +46,7 @@ brew install autoconf libxslt fop wxwidgets openssl | |
|
||
You can reference the E2E test in MacOS 13: [https://github.com/version-fox/vfox-erlang/actions/workflows/e2e_test.yaml](https://github.com/version-fox/vfox-erlang/actions/workflows/e2e_test.yaml) | ||
|
||
## Note | ||
### Note | ||
|
||
By default, vfox-erlang plugin will Build [EEP-48 documentation chunks](https://www.erlang.org/doc/apps/kernel/eep48_chapter) for get doc in REPL (eg: h(list).) and [lsp docs hint](https://github.com/elixir-lsp/vscode-elixir-ls/issues/284). | ||
|
||
|
@@ -59,3 +59,19 @@ You cal also use the `OTP_CONFIGURE_ARGS` environment variable to control instal | |
export OTP_CONFIGURE_ARGS="--enable-jit --enable-kernel-poll" | ||
vfox install [email protected] | ||
``` | ||
|
||
## install Erlang/OTP in Windows platform | ||
|
||
In windows, the vfox-erlang plugin downloads the Erlang/OTP version of the exe installer from the [Erlang/OTP releases](https://github.com/erlang/otp/releases) and executes it for you. | ||
|
||
This is an installation example in PowerShell: | ||
|
||
```pwsh | ||
vfox install [email protected] | ||
vfox use [email protected] | ||
Invoke-Expression "$(vfox activate pwsh)" | ||
# Test the installation results | ||
& erl.exe -eval 'erlang:display({otp_release, erlang:system_info(otp_release)}), halt().' -noshell | ||
``` | ||
|
||
You can reference the E2E test in in windows-2022: [https://github.com/version-fox/vfox-erlang/actions/workflows/e2e_test.yaml](https://github.com/version-fox/vfox-erlang/actions/workflows/e2e_test.yaml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,17 +6,24 @@ local erlangUtils = require("erlang_utils") | |
--- @field ctx.version string User-input version | ||
--- @return table Version information | ||
function PLUGIN:PreInstall(ctx) | ||
|
||
erlangUtils.check_platform() | ||
|
||
local erlang_version = ctx.version | ||
print("You will install the Erlang/OTP version is: " .. erlang_version) | ||
if erlang_version == nil then | ||
print("You will install the Erlang/OTP version is" .. erlang_version) | ||
error("You must provide a version number for Erlang/OTP, eg: vfox install [email protected]") | ||
end | ||
erlangUtils.check_version_existence("https://github.com/erlang/otp/releases/tag/OTP-" .. erlang_version) | ||
|
||
local download_url = "https://github.com/erlang/otp/archive/refs/tags/OTP-" .. erlang_version .. ".tar.gz" | ||
|
||
local download_url | ||
if RUNTIME.osType == "windows" then | ||
if RUNTIME.archType == "amd64" then | ||
download_url = "https://github.com/erlang/otp/releases/download/OTP-" .. erlang_version .. "/otp_win64_" .. erlang_version .. ".exe" | ||
else | ||
download_url = "https://github.com/erlang/otp/releases/download/OTP-" .. erlang_version .. "/otp_win32_" .. erlang_version .. ".exe" | ||
end | ||
else | ||
download_url = "https://github.com/erlang/otp/archive/refs/tags/OTP-" .. erlang_version .. ".tar.gz" | ||
end | ||
|
||
return { | ||
version = erlang_version, | ||
url = download_url | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters