Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch pre-compiled rebar3 instead of building it locally #16

Merged
merged 2 commits into from
Sep 12, 2024
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- name: Install system packages on Ubuntu
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get install curl erlang
run: sudo apt-get -y update && sudo apt-get -y install curl erlang

- name: Install system packages on macOS
if: ${{ runner.os == 'macOS' }}
Expand All @@ -38,6 +38,7 @@ jobs:
uses: asdf-vm/actions/plugin-test@v1
with:
command: rebar3 --version
version: 3.22.0

lint:
runs-on: ubuntu-latest
Expand Down
45 changes: 25 additions & 20 deletions bin/install
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best seen with Hide whitespace enabled as part of this included changes in formatting.

Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,31 @@ install_rebar() {

# Running this in a subshell because we don't to disturb the current
# working directory.
(
cd "$(dirname "$source_path")" || exit 1
tar zxvf "$source_path" &>/dev/null || exit 1

cd "$(untar_path "$install_type" "$version" "$tmp_download_dir")" || exit 1

# Build rebar
./bootstrap || exit 1
if version_3x_or_greater "$version"; then
(
cd "$(dirname "$source_path")" || exit 1

# Copy (executable) rebar3 into the bin directory inside the asdf install directory
chmod +x rebar3 || exit 1
mkdir -p "$install_path/bin/" || exit 1
cp rebar3 "$install_path/bin/" || exit 1
)
else
(
cd "$(dirname "$source_path")" || exit 1
tar zxvf "$source_path" &>/dev/null || exit 1

# Copy rebar into the bin directory inside the asdf install directory
mkdir -p "$install_path/bin/" || exit 1
cd "$(untar_path "$install_type" "$version" "$tmp_download_dir")" || exit 1

if version_3x_or_greater "$version"; then
local rebar3_binary="_build/default/bin/rebar3"
# Build rebar
./bootstrap || exit 1

if [ ! -f $rebar3_binary ]; then
rebar3_binary="_build/prod/bin/rebar3"
fi
# Copy rebar into the bin directory inside the asdf install directory
mkdir -p "$install_path/bin/" || exit 1

cp "$rebar3_binary" "$install_path/bin/" || exit 1
else
cp rebar "$install_path/bin/" || exit 1
fi
)
)
fi
}

download_source() {
Expand All @@ -72,6 +73,10 @@ get_download_file_path() {

local pkg_name="${rebar_version}.tar.gz"

if version_3x_or_greater "$version"; then
pkg_name="rebar3"
fi

echo "$tmp_download_dir/$pkg_name"
}

Expand Down Expand Up @@ -100,7 +105,7 @@ get_download_url() {
local version=$2

if version_3x_or_greater "$version"; then
echo "https://github.com/erlang/rebar3/archive/${version}.tar.gz"
echo "https://github.com/erlang/rebar3/releases/download/${version}/rebar3"
else
echo "https://github.com/rebar/rebar/archive/${version}.tar.gz"
fi
Expand Down
Loading