ci(fix): actually fail check for missing reboot apps
This commit is contained in:
parent
4f12d0ca67
commit
26d4ee5780
2
Makefile
2
Makefile
|
@ -99,7 +99,7 @@ static_checks:
|
||||||
@$(REBAR) as check do xref, dialyzer
|
@$(REBAR) as check do xref, dialyzer
|
||||||
@if [ "$${PROFILE}" = 'emqx-enterprise' ]; then $(REBAR) ct --suite apps/emqx/test/emqx_static_checks --readable $(CT_READABLE); fi
|
@if [ "$${PROFILE}" = 'emqx-enterprise' ]; then $(REBAR) ct --suite apps/emqx/test/emqx_static_checks --readable $(CT_READABLE); fi
|
||||||
./scripts/check-i18n-style.sh
|
./scripts/check-i18n-style.sh
|
||||||
./scripts/check_missing_reboot_apps.exs --profile $(PROFILE)
|
./scripts/check_missing_reboot_apps.exs
|
||||||
|
|
||||||
APPS=$(shell $(SCRIPTS)/find-apps.sh)
|
APPS=$(shell $(SCRIPTS)/find-apps.sh)
|
||||||
|
|
||||||
|
|
21
mix.exs
21
mix.exs
|
@ -446,13 +446,32 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
|
|
||||||
def check_profile!() do
|
def check_profile!() do
|
||||||
valid_envs = [
|
valid_envs = [
|
||||||
:dev,
|
|
||||||
:emqx,
|
:emqx,
|
||||||
:"emqx-pkg",
|
:"emqx-pkg",
|
||||||
:"emqx-enterprise",
|
:"emqx-enterprise",
|
||||||
:"emqx-enterprise-pkg"
|
:"emqx-enterprise-pkg"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if Mix.env() == :dev do
|
||||||
|
env_profile = System.get_env("PROFILE")
|
||||||
|
|
||||||
|
if env_profile do
|
||||||
|
# copy from PROFILE env var
|
||||||
|
System.get_env("PROFILE")
|
||||||
|
|> String.to_atom()
|
||||||
|
|> Mix.env()
|
||||||
|
else
|
||||||
|
IO.puts(
|
||||||
|
IO.ANSI.format([
|
||||||
|
:yellow,
|
||||||
|
"Warning: env var PROFILE is unset; defaulting to emqx"
|
||||||
|
])
|
||||||
|
)
|
||||||
|
|
||||||
|
Mix.env(:emqx)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if Mix.env() not in valid_envs do
|
if Mix.env() not in valid_envs do
|
||||||
formatted_envs =
|
formatted_envs =
|
||||||
valid_envs
|
valid_envs
|
||||||
|
|
|
@ -1,19 +1,33 @@
|
||||||
#!/usr/bin/env elixir
|
#!/usr/bin/env elixir
|
||||||
|
|
||||||
{parsed, _argv, _errors = []} =
|
alias EMQXUmbrella.MixProject
|
||||||
OptionParser.parse(
|
|
||||||
System.argv(),
|
|
||||||
strict: [profile: :string]
|
|
||||||
)
|
|
||||||
|
|
||||||
profile = Keyword.fetch!(parsed, :profile)
|
{:ok, _} = Application.ensure_all_started(:mix)
|
||||||
|
# note: run from the project root
|
||||||
|
File.cwd!()
|
||||||
|
|> Path.join("mix.exs")
|
||||||
|
|> Code.compile_file()
|
||||||
|
|
||||||
|
inputs = MixProject.check_profile!()
|
||||||
|
profile = Mix.env()
|
||||||
|
|
||||||
|
# need to use this information because we might have compiled all
|
||||||
|
# applications in the test profile, and thus filter what's in the
|
||||||
|
# release lib directory.
|
||||||
|
rel_apps = MixProject.applications(inputs.edition_type)
|
||||||
|
|
||||||
|
apps =
|
||||||
|
rel_apps
|
||||||
|
|> Keyword.keys()
|
||||||
|
|> Enum.filter(&(to_string(&1) =~ "emqx"))
|
||||||
|
|> Enum.reject(&(&1 in [:emqx_mix]))
|
||||||
|
|
||||||
:xref.start(:xref)
|
:xref.start(:xref)
|
||||||
:xref.set_default(:xref, warnings: false)
|
:xref.set_default(:xref, warnings: false)
|
||||||
rel_dir = '_build/#{profile}/lib/'
|
rel_dir = '_build/#{profile}/lib/'
|
||||||
:xref.add_release(:xref, rel_dir)
|
:xref.add_release(:xref, rel_dir)
|
||||||
|
|
||||||
{:ok, calls} = :xref.q(:xref, '(App) (XC || "mria":"create_table"/".*")')
|
{:ok, calls} = :xref.q(:xref, '(App) (XC | [#{Enum.join(apps, ",")}] || mria:create_table/_)')
|
||||||
|
|
||||||
emqx_calls =
|
emqx_calls =
|
||||||
calls
|
calls
|
||||||
|
@ -59,4 +73,6 @@ if MapSet.size(missing_reboot_apps) != 0 do
|
||||||
" otherwise, when a node joins a cluster, it might lose tables.\n"
|
" otherwise, when a node joins a cluster, it might lose tables.\n"
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
System.halt(1)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue