ci: fix elvis check
This commit is contained in:
parent
dc58e4a441
commit
d1abb30818
|
@ -7,6 +7,8 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1000
|
||||
- name: Set git token
|
||||
if: endsWith(github.repository, 'enterprise')
|
||||
run: |
|
||||
|
@ -14,7 +16,12 @@ jobs:
|
|||
git config --global credential.helper store
|
||||
- name: Run elvis check
|
||||
run: |
|
||||
./scripts/elvis-check.sh $GITHUB_BASE_REF
|
||||
set -e
|
||||
if [ -f EMQX_ENTERPRISE ]; then
|
||||
./scripts/elvis-check.sh $GITHUB_BASE_REF emqx-enterprise
|
||||
else
|
||||
./scripts/elvis-check.sh $GITHUB_BASE_REF emqx
|
||||
fi
|
||||
- name: Check line-break at EOF
|
||||
- run: |
|
||||
./scripts/check-nl-at-eof.sh
|
||||
|
|
|
@ -112,7 +112,8 @@ t_out(_) ->
|
|||
t_out_2(_) ->
|
||||
{empty, {pqueue, [{-1, {queue, [a], [], 1}}]}} = ?PQ:out(0, ?PQ:from_list([{1, a}])),
|
||||
{{value, a}, {queue, [], [], 0}} = ?PQ:out(1, ?PQ:from_list([{1, a}])),
|
||||
{{value, a}, {pqueue, [{-1, {queue, [], [b], 1}}]}} = ?PQ:out(1, ?PQ:from_list([{1, a}, {1, b}])),
|
||||
{{value, a}, {pqueue, [{-1, {queue, [], [b], 1}}]}} =
|
||||
?PQ:out(1, ?PQ:from_list([{1, a}, {1, b}])),
|
||||
{{value, a}, {queue, [b], [], 1}} = ?PQ:out(1, ?PQ:from_list([{1, a}, {0, b}])).
|
||||
|
||||
t_out_p(_) ->
|
||||
|
|
|
@ -100,7 +100,8 @@ on_start(InstId, #{redis_type := Type,
|
|||
Options = case maps:get(enable, SSL) of
|
||||
true ->
|
||||
[{ssl, true},
|
||||
{ssl_options, emqx_plugin_libs_ssl:save_files_return_opts(SSL, "connectors", InstId)}
|
||||
{ssl_options,
|
||||
emqx_plugin_libs_ssl:save_files_return_opts(SSL, "connectors", InstId)}
|
||||
];
|
||||
false -> [{ssl, false}]
|
||||
end ++ [{sentinel, maps:get(sentinel, Config, undefined)}],
|
||||
|
|
|
@ -131,10 +131,10 @@ setnth(tail, List, Val) when is_list(List) -> List ++ [Val];
|
|||
setnth(tail, _List, Val) -> [Val];
|
||||
setnth(I, List, _Val) when not is_integer(I) -> List;
|
||||
setnth(0, List, _Val) -> List;
|
||||
setnth(I, List, _Val) when is_integer(I), I > 0 ->
|
||||
do_setnth(I, List, _Val);
|
||||
setnth(I, List, _Val) when is_integer(I), I < 0 ->
|
||||
lists:reverse(do_setnth(-I, lists:reverse(List), _Val)).
|
||||
setnth(I, List, Val) when is_integer(I), I > 0 ->
|
||||
do_setnth(I, List, Val);
|
||||
setnth(I, List, Val) when is_integer(I), I < 0 ->
|
||||
lists:reverse(do_setnth(-I, lists:reverse(List), Val)).
|
||||
|
||||
do_setnth(1, [_ | Rest], Val) -> [Val | Rest];
|
||||
do_setnth(I, [E | Rest], Val) -> [E | setnth(I-1, Rest, Val)];
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
ELVIS_VERSION='1.0.0-emqx-2'
|
||||
elvis_version='1.0.0-emqx-2'
|
||||
|
||||
base="${1:-}"
|
||||
repo="${2:-emqx}"
|
||||
REPO="${GITHUB_REPOSITORY:-${repo}}"
|
||||
if [ "${base}" = "" ]; then
|
||||
echo "Usage $0 <git-compare-base-ref>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elvis_version="${2:-$ELVIS_VERSION}"
|
||||
|
||||
echo "elvis -v: $elvis_version"
|
||||
echo "git diff base: $base"
|
||||
|
||||
|
@ -27,11 +27,7 @@ if [[ "$base" =~ [0-9a-f]{8,40} ]]; then
|
|||
# base is a commit sha1
|
||||
compare_base="$base"
|
||||
else
|
||||
if [[ $CI == true ]];then
|
||||
remote="$(git remote -v | grep -E "github\.com(.|/)$GITHUB_REPOSITORY" | grep fetch | awk '{print $1}')"
|
||||
else
|
||||
remote="$(git remote -v | grep -E 'github\.com(.|/)emqx' | grep fetch | awk '{print $1}')"
|
||||
fi
|
||||
remote="$(git remote -v | grep -E "github\.com(:|/)emqx/$REPO((\.git)|(\s))" | grep fetch | awk '{print $1}')"
|
||||
git fetch "$remote" "$base"
|
||||
compare_base="$remote/$base"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue