Skip to content

Commit e8545b5

Browse files
authored
feat: support install erlang/otp from Bob prebuilt release in ubuntu linux (#8), close #7 [no ci]
* feat: support install erlang/otp from Bob prebuilt release * feat: vfox search prebuilt version * chore: test prebuilt release install * fix: env keys * refactor: impl for prebuilt release * fix: prebuilt release bin search * fix: vofx search prebuilt version * feat: download prebuilt version ca * ci: fix prebuilt test
1 parent 8d65c3f commit e8545b5

12 files changed

Lines changed: 548 additions & 22 deletions
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: E2E tests on Linux (Prebuilt release)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
schedule:
9+
# Runs at 12am UTC
10+
- cron: '0 0 * * *'
11+
12+
jobs:
13+
e2e_tests:
14+
strategy:
15+
matrix:
16+
# ref: https://github.com/actions/runner-images
17+
os: [ubuntu-20.04]
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: install vfox (Linux)
23+
run: |
24+
echo "deb [trusted=yes] https://apt.fury.io/versionfox/ /" | sudo tee /etc/apt/sources.list.d/versionfox.list
25+
sudo apt-get update
26+
sudo apt-get install vfox
27+
28+
- name: add vfox-erlang plugin (Unix-like)
29+
run: |
30+
vfox add --source https://github.com/version-fox/vfox-erlang/archive/${GITHUB_REF}.zip erlang
31+
32+
- name: prepare Erlang/OTP deps (Linux)
33+
run: |
34+
sudo DEBIAN_FRONTEND=noninteractive 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
35+
36+
- name: install Erlang/OTP by vfox-erlang plugin (Linux)
37+
run: |
38+
export MAKEFLAGS=-j4
39+
export USE_PREBUILT_OTP="ubuntu-20.04"
40+
vfox install erlang@maint-27
41+
vfox use -g erlang@maint-27
42+
eval "$(vfox activate bash)"
43+
echo "===============PATH==============="
44+
echo $PATH
45+
echo "===============PATH==============="
46+
cd assets
47+
erlc hello.erl
48+
erl -noshell -s hello hello_world -s init stop

DEVELOPMENT.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Developer Guide
2+
3+
## How vfox-erlang plugin work
4+
5+
- download & compile Erlang/OTP from GitHub Release: https://github.com/erlang/otp/releases
6+
- download prebuilt Erlang/OTP from hexpm/bob: https://github.com/hexpm/bob?tab=readme-ov-file#erlang-builds
7+

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,18 @@ Invoke-Expression "$(vfox activate pwsh)"
8282
```
8383

8484
You can reference the E2E test in in windows-2022: [.github/workflows/e2e_test_windows.yaml](.github/workflows/e2e_test_windows.yaml)
85+
86+
## install a prebuilt Erlang/OTP version
87+
88+
After vfox-erlang v1.1.0, you can also install a prebuilt Erlang/OTP version in Ubuntu linux system.
89+
90+
**Before install, you must disable vfox search cache.** Reference: [https://vfox.lhan.me/guides/configuration.html#cache-settings](https://vfox.lhan.me/guides/configuration.html#cache-settings)
91+
92+
This is an installation example in Bash Shell:
93+
94+
```shell
95+
# install an available version, you can also a avaliable version in: https://bobs-list.kobrakai.de/
96+
USE_PREBUILT_OTP="ubuntu-20.04" vfox search erlang
97+
```
98+
99+
**USE_PREBUILT_OTP** var value is one of: ["ubuntu-14.04", "ubuntu-16.04", "ubuntu-18.04", "ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"].

assets/erlang_otp_versions_from_gtihub_api.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@
4949
},
5050
"node_id": "MDM6UmVmMzc0OTI3OnJlZnMvdGFncy9SMTZCMDJfeWllbGRpbmdfYmluYXJ5X3RvX3Rlcm0="
5151
},
52+
{
53+
"name": "OTP-27.2.1",
54+
"zipball_url": "https://api.github.com/repos/erlang/otp/zipball/refs/tags/OTP-27.2.1",
55+
"tarball_url": "https://api.github.com/repos/erlang/otp/tarball/refs/tags/OTP-27.2.1",
56+
"commit": {
57+
"sha": "4726e39654c7a7412f7c2f66c7eb567c978a9947",
58+
"url": "https://api.github.com/repos/erlang/otp/commits/4726e39654c7a7412f7c2f66c7eb567c978a9947"
59+
},
60+
"node_id": "MDM6UmVmMzc0OTI3OnJlZnMvdGFncy9PVFAtMjcuMi4x"
61+
},
5262
{
5363
"name": "OTP-27.2",
5464
"zipball_url": "https://api.github.com/repos/erlang/otp/zipball/refs/tags/OTP-27.2",

assets/get_all_otp_versions.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ def update_all_version_from_github_api():
1818
with open("erlang_otp_versions_from_gtihub_api.json", 'w', encoding="utf-8") as file:
1919
json.dump(all_version, file, indent=4)
2020

21+
def get_all_prebuilt_version_from_bob():
22+
# ALLOW_OS_RELEASE = ["ubuntu-14.04", "ubuntu-16.04", "ubuntu-18.04", "ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"]
23+
ALLOW_OS_RELEASE = ["ubuntu-20.04"]
24+
all_version_info = []
25+
for release in ALLOW_OS_RELEASE:
26+
url = f"https://builds.hex.pm/builds/otp/{release}/builds.txt"
27+
response = requests.get(url)
28+
all_version_info = response.text.split("\n")
29+
30+
all_prebuilt_versions = []
31+
for version in all_version_info:
32+
if version.split(" ")[0]:
33+
all_prebuilt_versions.append(version.split(" ")[0])
34+
return all_prebuilt_versions
35+
2136
def get_all_version():
2237
version_set = set()
2338
with open("erlang_otp_versions_from_gtihub_api.json", 'r', encoding="utf-8") as file:
@@ -33,7 +48,12 @@ def get_all_version():
3348
update_all_version_from_github_api()
3449
versions = list(get_all_version())
3550
versions.sort(reverse=True)
36-
print(versions)
51+
# print(versions)
3752
with open("versions.txt", 'w') as file:
3853
for version in versions:
54+
file.write(version + '\n')
55+
with open("prebuilt_versions.txt", 'w') as file:
56+
prebuilt_versions = get_all_prebuilt_version_from_bob()
57+
prebuilt_versions.sort(reverse=True)
58+
for version in prebuilt_versions:
3959
file.write(version + '\n')

0 commit comments

Comments
 (0)