From b05b77bcbc9c3d13322aa33d445d555ca7032659 Mon Sep 17 00:00:00 2001 From: Shawn <506895667@qq.com> Date: Thu, 28 Apr 2022 19:28:29 +0800 Subject: [PATCH 1/2] chore: port ensure-rebar3.sh from 4.x --- Makefile | 3 +-- scripts/ensure-rebar3.sh | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3c31d62ab..586ab8f22 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ $(shell $(CURDIR)/scripts/git-hooks-init.sh) -REBAR_VERSION = 3.16.1-emqx-1 REBAR = $(CURDIR)/rebar3 BUILD = $(CURDIR)/build SCRIPTS = $(CURDIR)/scripts @@ -36,7 +35,7 @@ all: $(REBAR) $(PROFILES) .PHONY: ensure-rebar3 ensure-rebar3: - @$(SCRIPTS)/ensure-rebar3.sh $(REBAR_VERSION) + @$(SCRIPTS)/ensure-rebar3.sh .PHONY: ensure-hex ensure-hex: diff --git a/scripts/ensure-rebar3.sh b/scripts/ensure-rebar3.sh index f15127030..a735ead43 100755 --- a/scripts/ensure-rebar3.sh +++ b/scripts/ensure-rebar3.sh @@ -2,7 +2,21 @@ set -euo pipefail -VERSION="$1" +## rebar3 tag 3.18.0-emqx-1 is compiled using otp24.1.5. +## we have to use an otp24-compiled rebar3 because the defination of record #application{} +## in systools.hrl is changed in otp24. +case ${OTP_VSN} in + 23*) + VERSION="3.16.1-emqx-1" + ;; + 24*) + VERSION="3.18.0-emqx-1" + ;; + *) + echo "Unsupporetd Erlang/OTP version $OTP_VSN" + exit 1 + ;; +esac # ensure dir cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." @@ -10,7 +24,8 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." DOWNLOAD_URL='https://github.com/emqx/rebar3/releases/download' download() { - curl --silent --show-error -f -L "${DOWNLOAD_URL}/${VERSION}/rebar3" -o ./rebar3 + echo "downloading rebar3 ${VERSION}" + curl -f -L "${DOWNLOAD_URL}/${VERSION}/rebar3" -o ./rebar3 } # get the version number from the second line of the escript From 50f1dcef97c2d1679739eabb4ec4bf82a13bb9fa Mon Sep 17 00:00:00 2001 From: Shawn <506895667@qq.com> Date: Thu, 28 Apr 2022 23:07:38 +0800 Subject: [PATCH 2/2] fix: update elixir CI yamls for getting rebar3 --- .github/workflows/elixir_apps_check.yaml | 2 +- .github/workflows/elixir_deps_check.yaml | 2 +- scripts/ensure-rebar3.sh | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/elixir_apps_check.yaml b/.github/workflows/elixir_apps_check.yaml index 609b28617..2f40a1f81 100644 --- a/.github/workflows/elixir_apps_check.yaml +++ b/.github/workflows/elixir_apps_check.yaml @@ -36,7 +36,7 @@ jobs: with: fetch-depth: 0 - name: ensure rebar - run: ./scripts/ensure-rebar3.sh 3.16.1-emqx-1 + run: ./scripts/ensure-rebar3.sh - name: check applications run: ./scripts/check-elixir-applications.exs - name: check applications started with emqx_machine diff --git a/.github/workflows/elixir_deps_check.yaml b/.github/workflows/elixir_deps_check.yaml index 8a58f6fd1..5cc9c25d2 100644 --- a/.github/workflows/elixir_deps_check.yaml +++ b/.github/workflows/elixir_deps_check.yaml @@ -13,7 +13,7 @@ jobs: - name: Checkout uses: actions/checkout@v2.4.0 - name: ensure rebar - run: ./scripts/ensure-rebar3.sh 3.16.1-emqx-1 + run: ./scripts/ensure-rebar3.sh - name: setup mix run: | mix local.hex --force diff --git a/scripts/ensure-rebar3.sh b/scripts/ensure-rebar3.sh index a735ead43..e31dba207 100755 --- a/scripts/ensure-rebar3.sh +++ b/scripts/ensure-rebar3.sh @@ -5,6 +5,7 @@ set -euo pipefail ## rebar3 tag 3.18.0-emqx-1 is compiled using otp24.1.5. ## we have to use an otp24-compiled rebar3 because the defination of record #application{} ## in systools.hrl is changed in otp24. +OTP_VSN="${OTP_VSN:-$(./scripts/get-otp-vsn.sh)}" case ${OTP_VSN} in 23*) VERSION="3.16.1-emqx-1"