From 3dcc681ab89c5c019dd952a4b23c378890fd571f Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Wed, 11 Sep 2024 22:26:05 +0200 Subject: [PATCH 1/2] Fetch pre-compiled rebar3 instead of building it locally Advantages: * faster build time (no build, actually) * wider Erlang version range - compatibility (since it's build for Erlang by erlang/rebar3) --- bin/install | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/bin/install b/bin/install index ceab873..6f81f91 100755 --- a/bin/install +++ b/bin/install @@ -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() { @@ -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" } @@ -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 From 4fb51c2992a0ea3f70d8c354a0cc281168d591be Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Thu, 12 Sep 2024 00:58:48 +0200 Subject: [PATCH 2/2] Fix CI issues The Ubuntu image started failing (most likely because we're using -latest on the CI matrix) We choose a specific version of `rebar3` that works with the Ubuntu image (which is OTP 24) since that one's not been updated recently --- .github/workflows/workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 518ce80..3320fe3 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -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' }} @@ -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