Merge pull request #9894 from id/ci-always-run-static-checks
ci: always run static_checks
This commit is contained in:
commit
7ea140599a
|
@ -55,10 +55,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
make ${EMQX_NAME}-tgz
|
make ${EMQX_NAME}-tgz
|
||||||
./scripts/pkg-tests.sh ${EMQX_NAME}-tgz
|
./scripts/pkg-tests.sh ${EMQX_NAME}-tgz
|
||||||
- name: run static checks
|
|
||||||
if: contains(matrix.os, 'ubuntu')
|
|
||||||
run: |
|
|
||||||
make static_checks
|
|
||||||
- name: build and test deb/rpm packages
|
- name: build and test deb/rpm packages
|
||||||
run: |
|
run: |
|
||||||
make ${EMQX_NAME}-pkg
|
make ${EMQX_NAME}-pkg
|
||||||
|
|
|
@ -77,6 +77,7 @@ jobs:
|
||||||
make ensure-rebar3
|
make ensure-rebar3
|
||||||
# fetch all deps and compile
|
# fetch all deps and compile
|
||||||
make ${{ matrix.profile }}
|
make ${{ matrix.profile }}
|
||||||
|
make static_checks
|
||||||
make test-compile
|
make test-compile
|
||||||
cd ..
|
cd ..
|
||||||
zip -ryq source.zip source/* source/.[^.]*
|
zip -ryq source.zip source/* source/.[^.]*
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -79,7 +79,8 @@ ct: $(REBAR) merge-config
|
||||||
|
|
||||||
.PHONY: static_checks
|
.PHONY: static_checks
|
||||||
static_checks:
|
static_checks:
|
||||||
@$(REBAR) as check do dialyzer, xref, ct --suite apps/emqx/test/emqx_static_checks --readable $(CT_READABLE)
|
@$(REBAR) as check do dialyzer, xref
|
||||||
|
@if [ "$${PROFILE}" = 'emqx-enterprise' ]; then $(REBAR) ct --suite apps/emqx/test/emqx_static_checks --readable $(CT_READABLE); fi
|
||||||
|
|
||||||
APPS=$(shell $(SCRIPTS)/find-apps.sh)
|
APPS=$(shell $(SCRIPTS)/find-apps.sh)
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
% Reason: legacy code. A fun and a QC query are
|
% Reason: legacy code. A fun and a QC query are
|
||||||
% passed in the args, it's futile to try to statically
|
% passed in the args, it's futile to try to statically
|
||||||
% check it
|
% check it
|
||||||
"emqx_mgmt_api:do_query/2, emqx_mgmt_api:collect_total_from_tail_nodes/3"
|
"emqx_mgmt_api:do_query/2, emqx_mgmt_api:collect_total_from_tail_nodes/2"
|
||||||
).
|
).
|
||||||
|
|
||||||
-define(XREF, myxref).
|
-define(XREF, myxref).
|
||||||
|
|
|
@ -171,12 +171,12 @@ bridge_info_examples(Method, WithMetrics) ->
|
||||||
ee_bridge_examples(Method)
|
ee_bridge_examples(Method)
|
||||||
).
|
).
|
||||||
|
|
||||||
|
-if(?EMQX_RELEASE_EDITION == ee).
|
||||||
ee_bridge_examples(Method) ->
|
ee_bridge_examples(Method) ->
|
||||||
try
|
emqx_ee_bridge:examples(Method).
|
||||||
emqx_ee_bridge:examples(Method)
|
-else.
|
||||||
catch
|
ee_bridge_examples(_Method) -> #{}.
|
||||||
_:_ -> #{}
|
-endif.
|
||||||
end.
|
|
||||||
|
|
||||||
info_example(Type, Method, WithMetrics) ->
|
info_example(Type, Method, WithMetrics) ->
|
||||||
maps:merge(
|
maps:merge(
|
||||||
|
|
|
@ -56,8 +56,8 @@ api_schema(Method) ->
|
||||||
EE = ee_api_schemas(Method),
|
EE = ee_api_schemas(Method),
|
||||||
hoconsc:union(Broker ++ EE).
|
hoconsc:union(Broker ++ EE).
|
||||||
|
|
||||||
|
-if(?EMQX_RELEASE_EDITION == ee).
|
||||||
ee_api_schemas(Method) ->
|
ee_api_schemas(Method) ->
|
||||||
%% must ensure the app is loaded before checking if fn is defined.
|
|
||||||
ensure_loaded(emqx_ee_bridge, emqx_ee_bridge),
|
ensure_loaded(emqx_ee_bridge, emqx_ee_bridge),
|
||||||
case erlang:function_exported(emqx_ee_bridge, api_schemas, 1) of
|
case erlang:function_exported(emqx_ee_bridge, api_schemas, 1) of
|
||||||
true -> emqx_ee_bridge:api_schemas(Method);
|
true -> emqx_ee_bridge:api_schemas(Method);
|
||||||
|
@ -65,13 +65,31 @@ ee_api_schemas(Method) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
ee_fields_bridges() ->
|
ee_fields_bridges() ->
|
||||||
%% must ensure the app is loaded before checking if fn is defined.
|
|
||||||
ensure_loaded(emqx_ee_bridge, emqx_ee_bridge),
|
ensure_loaded(emqx_ee_bridge, emqx_ee_bridge),
|
||||||
case erlang:function_exported(emqx_ee_bridge, fields, 1) of
|
case erlang:function_exported(emqx_ee_bridge, fields, 1) of
|
||||||
true -> emqx_ee_bridge:fields(bridges);
|
true -> emqx_ee_bridge:fields(bridges);
|
||||||
false -> []
|
false -> []
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
%% must ensure the app is loaded before checking if fn is defined.
|
||||||
|
ensure_loaded(App, Mod) ->
|
||||||
|
try
|
||||||
|
_ = application:load(App),
|
||||||
|
_ = Mod:module_info(),
|
||||||
|
ok
|
||||||
|
catch
|
||||||
|
_:_ ->
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
|
-else.
|
||||||
|
|
||||||
|
ee_api_schemas(_) -> [].
|
||||||
|
|
||||||
|
ee_fields_bridges() -> [].
|
||||||
|
|
||||||
|
-endif.
|
||||||
|
|
||||||
common_bridge_fields() ->
|
common_bridge_fields() ->
|
||||||
[
|
[
|
||||||
{enable,
|
{enable,
|
||||||
|
@ -194,17 +212,3 @@ status() ->
|
||||||
|
|
||||||
node_name() ->
|
node_name() ->
|
||||||
{"node", mk(binary(), #{desc => ?DESC("desc_node_name"), example => "emqx@127.0.0.1"})}.
|
{"node", mk(binary(), #{desc => ?DESC("desc_node_name"), example => "emqx@127.0.0.1"})}.
|
||||||
|
|
||||||
%%=================================================================================================
|
|
||||||
%% Internal fns
|
|
||||||
%%=================================================================================================
|
|
||||||
|
|
||||||
ensure_loaded(App, Mod) ->
|
|
||||||
try
|
|
||||||
_ = application:load(App),
|
|
||||||
_ = Mod:module_info(),
|
|
||||||
ok
|
|
||||||
catch
|
|
||||||
_:_ ->
|
|
||||||
ok
|
|
||||||
end.
|
|
||||||
|
|
|
@ -257,12 +257,8 @@ send_to_remote_async(Name, MsgIn, Callback) ->
|
||||||
|
|
||||||
do_send_async(Name, {true, Msg}, Callback) ->
|
do_send_async(Name, {true, Msg}, Callback) ->
|
||||||
Pid = get_pid(Name),
|
Pid = get_pid(Name),
|
||||||
case emqtt:publish_async(Pid, Msg, _Timeout = infinity, Callback) of
|
ok = emqtt:publish_async(Pid, Msg, _Timeout = infinity, Callback),
|
||||||
ok ->
|
|
||||||
{ok, Pid};
|
{ok, Pid};
|
||||||
{error, _} = Error ->
|
|
||||||
Error
|
|
||||||
end;
|
|
||||||
do_send_async(_Name, false, _Callback) ->
|
do_send_async(_Name, false, _Callback) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ start_link() ->
|
||||||
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
|
||||||
|
|
||||||
init([]) ->
|
init([]) ->
|
||||||
ets:new(?MODULE, [set, named_table, public, {keypos, 1}]),
|
_ = ets:new(?MODULE, [set, named_table, public, {keypos, 1}]),
|
||||||
{ok, #{latest_refresh => 0}}.
|
{ok, #{latest_refresh => 0}}.
|
||||||
|
|
||||||
handle_call(get_sys_memory, _From, State) ->
|
handle_call(get_sys_memory, _From, State) ->
|
||||||
|
|
|
@ -31,7 +31,9 @@
|
||||||
pick_key => term(),
|
pick_key => term(),
|
||||||
timeout => timeout(),
|
timeout => timeout(),
|
||||||
expire_at => infinity | integer(),
|
expire_at => infinity | integer(),
|
||||||
async_reply_fun => reply_fun()
|
async_reply_fun => reply_fun(),
|
||||||
|
simple_query => boolean(),
|
||||||
|
is_buffer_supported => boolean()
|
||||||
}.
|
}.
|
||||||
-type resource_data() :: #{
|
-type resource_data() :: #{
|
||||||
id := resource_id(),
|
id := resource_id(),
|
||||||
|
|
|
@ -194,7 +194,7 @@ remove(ResId, ClearMetrics) when is_binary(ResId) ->
|
||||||
restart(ResId, Opts) when is_binary(ResId) ->
|
restart(ResId, Opts) when is_binary(ResId) ->
|
||||||
case safe_call(ResId, restart, ?T_OPERATION) of
|
case safe_call(ResId, restart, ?T_OPERATION) of
|
||||||
ok ->
|
ok ->
|
||||||
wait_for_ready(ResId, maps:get(start_timeout, Opts, 5000)),
|
_ = wait_for_ready(ResId, maps:get(start_timeout, Opts, 5000)),
|
||||||
ok;
|
ok;
|
||||||
{error, _Reason} = Error ->
|
{error, _Reason} = Error ->
|
||||||
Error
|
Error
|
||||||
|
@ -205,7 +205,7 @@ restart(ResId, Opts) when is_binary(ResId) ->
|
||||||
start(ResId, Opts) ->
|
start(ResId, Opts) ->
|
||||||
case safe_call(ResId, start, ?T_OPERATION) of
|
case safe_call(ResId, start, ?T_OPERATION) of
|
||||||
ok ->
|
ok ->
|
||||||
wait_for_ready(ResId, maps:get(start_timeout, Opts, 5000)),
|
_ = wait_for_ready(ResId, maps:get(start_timeout, Opts, 5000)),
|
||||||
ok;
|
ok;
|
||||||
{error, _Reason} = Error ->
|
{error, _Reason} = Error ->
|
||||||
Error
|
Error
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -58,7 +58,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
{:grpc, github: "emqx/grpc-erl", tag: "0.6.7", override: true},
|
{:grpc, github: "emqx/grpc-erl", tag: "0.6.7", override: true},
|
||||||
{:minirest, github: "emqx/minirest", tag: "1.3.7", override: true},
|
{:minirest, github: "emqx/minirest", tag: "1.3.7", override: true},
|
||||||
{:ecpool, github: "emqx/ecpool", tag: "0.5.3", override: true},
|
{:ecpool, github: "emqx/ecpool", tag: "0.5.3", override: true},
|
||||||
{:replayq, github: "emqx/replayq", tag: "0.3.6", override: true},
|
{:replayq, github: "emqx/replayq", tag: "0.3.7", override: true},
|
||||||
{:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4", override: true},
|
{:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4", override: true},
|
||||||
{:emqtt, github: "emqx/emqtt", tag: "1.7.0-rc.2", override: true},
|
{:emqtt, github: "emqx/emqtt", tag: "1.7.0-rc.2", override: true},
|
||||||
{:rulesql, github: "emqx/rulesql", tag: "0.1.4"},
|
{:rulesql, github: "emqx/rulesql", tag: "0.1.4"},
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
, {grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.7"}}}
|
, {grpc, {git, "https://github.com/emqx/grpc-erl", {tag, "0.6.7"}}}
|
||||||
, {minirest, {git, "https://github.com/emqx/minirest", {tag, "1.3.7"}}}
|
, {minirest, {git, "https://github.com/emqx/minirest", {tag, "1.3.7"}}}
|
||||||
, {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.3"}}}
|
, {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.3"}}}
|
||||||
, {replayq, {git, "https://github.com/emqx/replayq.git", {tag, "0.3.6"}}}
|
, {replayq, {git, "https://github.com/emqx/replayq.git", {tag, "0.3.7"}}}
|
||||||
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
|
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
|
||||||
, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.7.0-rc.2"}}}
|
, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.7.0-rc.2"}}}
|
||||||
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}}
|
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}}
|
||||||
|
|
Loading…
Reference in New Issue