Merge pull request #6829 from k32/bpapi-lockdown

ci(bpapi): Fail static check on BPAPI violations
This commit is contained in:
k32 2022-01-21 16:08:17 +01:00 committed by GitHub
commit ffa857ccd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 10 deletions

View File

@ -70,15 +70,20 @@
-spec run() -> boolean(). -spec run() -> boolean().
run() -> run() ->
dump(), %% TODO: check return value case dump() of
Dumps = filelib:wildcard(dumps_dir() ++ "/*.bpapi"), true ->
case Dumps of Dumps = filelib:wildcard(dumps_dir() ++ "/*.bpapi"),
[] -> case Dumps of
?ERROR("No BPAPI dumps are found in ~s, abort", [dumps_dir()]), [] ->
false; ?ERROR("No BPAPI dumps are found in ~s, abort", [dumps_dir()]),
_ -> false;
?NOTICE("Running API compatibility checks for ~p", [Dumps]), _ ->
check_compat(Dumps) ?NOTICE("Running API compatibility checks for ~p", [Dumps]),
check_compat(Dumps)
end;
false ->
?CRITICAL("Backplane API violations found on the current branch."),
false
end. end.
-spec check_compat([file:filename()]) -> boolean(). -spec check_compat([file:filename()]) -> boolean().

View File

@ -19,6 +19,7 @@
-compile(export_all). -compile(export_all).
-compile(nowarn_export_all). -compile(nowarn_export_all).
-include_lib("emqx/include/logger.hrl").
-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct.hrl").
-include_lib("stdlib/include/assert.hrl"). -include_lib("stdlib/include/assert.hrl").
@ -28,7 +29,8 @@ init_per_suite(Config) ->
Config. Config.
end_per_suite(_Config) -> end_per_suite(_Config) ->
ok. ?NOTICE("If this test suite failed, and you are unsure why, read this:~n"
"https://github.com/emqx/emqx/blob/master/apps/emqx/src/bpapi/README.md", []).
t_run_check(_) -> t_run_check(_) ->
?assertMatch(true, emqx_bpapi_static_checks:run()). ?assertMatch(true, emqx_bpapi_static_checks:run()).