ci: backport patch for otp setup on self hosted macos from master

This commit is contained in:
Ivan Dyachkov 2022-12-19 09:57:03 +01:00
parent 30b1c5f26d
commit c776afd86a
4 changed files with 46 additions and 16 deletions

View File

@ -23,27 +23,38 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
- name: prepare - id: prepare
shell: bash shell: bash
run: | run: |
brew update brew update
brew install curl zip unzip gnu-sed coreutils unixodbc freetds openssl@1.1 brew install curl zip unzip gnu-sed coreutils autoconf automake cmake unixodbc freetds openssl@1.1
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
echo "/usr/local/bin" >> $GITHUB_PATH echo "/usr/local/bin" >> $GITHUB_PATH
OTP_SOURCE_PATH="$HOME/src/otp-${{ inputs.otp }}"
OTP_INSTALL_PATH="$HOME/otp/${{ inputs.otp }}"
echo "OTP_SOURCE_PATH=$OTP_SOURCE_PATH" >> $GITHUB_OUTPUT
echo "OTP_INSTALL_PATH=$OTP_INSTALL_PATH" >> $GITHUB_OUTPUT
mkdir -p "$OTP_INSTALL_PATH"
- uses: actions/cache@v3 - uses: actions/cache@v3
id: cache id: cache
with: with:
path: /opt/erlang/${{ inputs.otp }} path: ${{ steps.prepare.outputs.OTP_INSTALL_PATH }}
key: otp-install-${{ inputs.otp }}-${{ inputs.os }}-static-ssl-disable-hipe-disable-jit key: otp-install-${{ inputs.otp }}-${{ inputs.os }}-static-ssl-disable-hipe-disable-jit
- name: build erlang - name: build erlang
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
shell: bash shell: bash
run: | run: |
git clone --depth 1 --branch OTP-${{ inputs.otp }} https://github.com/emqx/otp.git $HOME/otp-${{ inputs.otp }} OTP_SOURCE_PATH="${{ steps.prepare.outputs.OTP_SOURCE_PATH }}"
cd $HOME/otp-${{ inputs.otp }} OTP_INSTALL_PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}"
./configure --disable-dynamic-ssl-lib --with-ssl=/usr/local/opt/openssl@1.1 --disable-hipe --disable-jit --prefix=/opt/erlang/${{ inputs.otp }} if [ -d "$OTP_SOURCE_PATH" ]; then
rm -rf "$OTP_SOURCE_PATH"
fi
git clone --depth 1 --branch OTP-${{ inputs.otp }} https://github.com/emqx/otp.git "$OTP_SOURCE_PATH"
cd "$OTP_SOURCE_PATH"
./configure --disable-dynamic-ssl-lib --with-ssl=$(brew --prefix openssl@1.1) --disable-hipe --disable-jit --prefix="$OTP_INSTALL_PATH"
make -j$(nproc) make -j$(nproc)
sudo make install rm -rf "$OTP_INSTALL_PATH"
make install
- name: build - name: build
env: env:
AUTO_INSTALL_BUILD_DEPS: 1 AUTO_INSTALL_BUILD_DEPS: 1
@ -56,13 +67,16 @@ runs:
APPLE_DEVELOPER_ID_BUNDLE_PASSWORD: ${{ inputs.apple_developer_id_bundle_password }} APPLE_DEVELOPER_ID_BUNDLE_PASSWORD: ${{ inputs.apple_developer_id_bundle_password }}
shell: bash shell: bash
run: | run: |
export PATH="/opt/erlang/${{ inputs.otp }}/bin:$PATH" export PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}/bin:$PATH"
make ensure-rebar3 make ensure-rebar3
sudo cp rebar3 /usr/local/bin/rebar3 mkdir -p $HOME/bin
cp rebar3 $HOME/bin/rebar3
export PATH="$HOME/bin:$PATH"
make ${EMQX_NAME}-zip make ${EMQX_NAME}-zip
- name: test - name: test
shell: bash shell: bash
run: | run: |
export PATH="${{ steps.prepare.outputs.OTP_INSTALL_PATH }}/bin:$PATH"
pkg_name=$(basename _packages/${EMQX_NAME}/${EMQX_NAME}-*.zip) pkg_name=$(basename _packages/${EMQX_NAME}/${EMQX_NAME}-*.zip)
unzip -q _packages/${EMQX_NAME}/$pkg_name unzip -q _packages/${EMQX_NAME}/$pkg_name
# test with a spaces in path # test with a spaces in path

View File

@ -149,5 +149,5 @@ jobs:
path: ./rebar3.crashdump path: ./rebar3.crashdump
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: macos name: ${{ matrix.os }}
path: _packages/**/*.zip path: _packages/**/*.zip

10
build
View File

@ -203,6 +203,16 @@ make_zip() {
;; ;;
esac esac
;; ;;
macos*)
case "$PKG_VSN" in
4.4.12*)
# this is the first version for macos arm (M1/M2), no relup
if [ "$ARCH" = arm64 ]; then
has_relup='no'
fi
;;
esac
;;
esac esac
# shellcheck disable=SC2207 # shellcheck disable=SC2207
bases=($(relup_db base-vsns "$PKG_VSN")) bases=($(relup_db base-vsns "$PKG_VSN"))

View File

@ -162,21 +162,26 @@ filter_froms(Froms0, AvailableVersionsIndex) ->
Froms1 = Froms1 =
case get_system() of case get_system() of
%% we do not support relup for windows %% we do not support relup for windows
"windows" -> {"windows", _} ->
[]; [];
%% debian11 is introduced since v4.4.2 and e4.4.2 %% debian11 is introduced since v4.4.2 and e4.4.2
%% exclude tags before them %% exclude tags before them
"debian11" -> {"debian11", _} ->
lists:filter( lists:filter(
fun(Vsn) -> fun(Vsn) ->
not lists:member(Vsn, [<<"4.4.0">>, <<"4.4.1">>]) not lists:member(Vsn, [<<"4.4.0">>, <<"4.4.1">>])
end, Froms0); end, Froms0);
%% amzn2 is introduced since v4.4.12 and e4.4.12 %% amzn2 is introduced since v4.4.12 and e4.4.12
%% exclude tags before them %% exclude tags before them
"amzn2" -> {"amzn2", _} ->
Excluded = [list_to_binary(["4.4.", integer_to_list(X)]) || X <- lists:seq(0,11)], Excluded = [list_to_binary(["4.4.", integer_to_list(X)]) || X <- lists:seq(0,11)],
lists:filter(fun(Vsn) -> not lists:member(Vsn, Excluded) end, Froms0); lists:filter(fun(Vsn) -> not lists:member(Vsn, Excluded) end, Froms0);
_ -> %% macos arm64 (M1/M2) packages are introduced since v4.4.12 and e4.4.12
%% exclude tags before them
{"macos" ++ _, "aarch64" ++ _} ->
Excluded = [list_to_binary(["4.4.", integer_to_list(X)]) || X <- lists:seq(0,11)],
lists:filter(fun(Vsn) -> not lists:member(Vsn, Excluded) end, Froms0);
{_, _} ->
Froms0 Froms0
end, end,
lists:filter( lists:filter(
@ -184,11 +189,12 @@ filter_froms(Froms0, AvailableVersionsIndex) ->
Froms1). Froms1).
get_system() -> get_system() ->
Arch = erlang:system_info(system_architecture),
case os:getenv("SYSTEM") of case os:getenv("SYSTEM") of
false -> false ->
string:trim(os:cmd("./scripts/get-distro.sh")); {string:trim(os:cmd("./scripts/get-distro.sh")), Arch};
System -> System ->
System {System, Arch}
end. end.
%% assumes that's X.Y.Z, without pre-releases %% assumes that's X.Y.Z, without pre-releases