test & Ci

This commit is contained in:
Mayel de Borniol 2024-02-13 17:07:18 +00:00
parent 3a807c7b27
commit 88320d6255
8 changed files with 58 additions and 38 deletions

View file

@ -77,10 +77,10 @@ jobs:
# - name: Remove mix.lock
# run: rm mix.lock
- name: Prepare environment
run: just pre-setup && just init
run: just pre-setup && just init &
- name: Install dependencies
run: mix deps.get
- name: Update Bonfire extensions to latest git versions
- name: Update Bonfire extensions to latest git versions (just use lockfile in future?)
run: mix bonfire.deps.update
- name: Fetch any differences in nested deps
run: mix deps.get
@ -89,7 +89,7 @@ jobs:
- name: Compile deps & app
run: mix compile
- name: Set up database
run: mix ecto.create && mix ecto.migrate
run: just extension-post-install && mix ecto.create && mix ecto.migrate
- name: Run tests
run: mix test
- name: Check database down migrations

View file

@ -4,29 +4,31 @@
use ConsoleHelpers
if module_enabled?(Bonfire.Common.Test.Interactive) and Mix.env() == :test do
# to run tests from iex
# if module_enabled?(Bonfire.Common.Test.Interactive) and Mix.env() == :test do
# # to run tests from iex
# Code.compiler_options(ignore_module_conflict: true)
# Code.compile_file("~/.iex/iex_watch_tests.exs", File.cwd!())
# # Code.compiler_options(ignore_module_conflict: true)
# # Code.compile_file("~/.iex/iex_watch_tests.exs", File.cwd!())
unless GenServer.whereis(Bonfire.Common.Test.Interactive) do
{:ok, pid} = Bonfire.Common.Test.Interactive.start_link()
# unless GenServer.whereis(Bonfire.Common.Test.Interactive) do
# {:ok, pid} = Bonfire.Common.Test.Interactive.start_link()
# Process will not exit when the iex goes out
Process.unlink(pid)
end
# # Process will not exit when the iex goes out
# Process.unlink(pid)
# end
# Bonfire.Common.Test.Interactive.Helpers.ready()
# else
# if Mix.env() == :test, do: info("IExWatchTests is not running")
# end
# import_if_enabled(Bonfire.Common.Test.Interactive.Helpers)
Bonfire.Common.Test.Interactive.Helpers.ready()
else
if Mix.env() == :test, do: info("IExWatchTests is not running")
end
# if Code.ensure_loaded?(ExSync) and function_exported?(ExSync, :register_group_leader, 0) do
# ExSync.register_group_leader()
# end
import_if_enabled(Bonfire.Common.Test.Interactive.Helpers)
defmodule ObserverCLI do
def observer_cli_start, do: start()

View file

@ -75,7 +75,7 @@ mogrify = "https://github.com/chaskiq/mogrify.git#identify-option"
# phoenix_live_view = "https://github.com/phoenixframework/phoenix_live_view#main"
# live_view_native = "https://github.com/bonfire-networks/live_view_native#wip"
# surface = "https://github.com/surface-ui/surface"
surface = "https://github.com/surface-ui/surface"
# surface_catalogue = "https://github.com/surface-ui/surface_catalogue" # Testing a UI component library
# bonfire_livebook = "https://github.com/bonfire-networks/bonfire_livebook#main"

View file

@ -1,5 +1,8 @@
import Config
test_instance? = System.get_env("TEST_INSTANCE") == "yes"
federate? = test_instance? or System.get_env("FEDERATE") == "yes"
## Import or set test configs for extensions
import_config "activity_pub_test.exs"
@ -19,9 +22,14 @@ config :bonfire_search,
## Other general test config
config :logger,
level: :debug,
level: :error,
truncate: :infinity
if !test_instance? do
# to supress non-captured logs in tests (eg. in setup_all)
config :logger, backends: []
end
config :logger, :console, truncate: :infinity
# Configure your database
@ -44,9 +52,6 @@ config :bonfire_umbrella, Bonfire.Common.Repo,
log: false,
stacktrace: true
test_instance? = System.get_env("TEST_INSTANCE") == "yes"
federate? = test_instance? or System.get_env("FEDERATE") == "yes"
config :tesla,
adapter: if(federate?, do: {Tesla.Adapter.Finch, name: Bonfire.Finch}, else: Tesla.Mock)

View file

@ -139,9 +139,12 @@ setup-dev:
just deps-clean-api
just deps-clean-unused
just deps-get
just db-migrations-copy
just extension-post-install
db-migrations-copy:
extension-post-install:
just ext-migrations-copy
ext-migrations-copy:
just mix bonfire.extension.copy_migrations --force
setup-prod:

View file

@ -61,6 +61,7 @@ defmodule Bonfire.Umbrella.MixProject do
{:grumble, "~> 0.1.3", only: [:test], override: true},
{:mix_test_watch, "~> 1.1", only: :test, runtime: false, override: true},
{:mix_test_interactive, "~> 1.2", only: :test, runtime: false},
{:ex_unit_summary, "~> 0.1.0", only: :test},
{:ex_unit_notifier, "~> 1.0", only: :test},
{:wallaby, "~> 0.30", runtime: false, only: :test},
{:credo, "~> 1.7.0", only: :test, override: true},

View file

@ -18,7 +18,7 @@
"bamboo_ses": {:hex, :bamboo_ses, "0.4.2", "e148a0ae17f8223b830029c2e81b2ba18220aa7378531ef1f50c4212fbd9ddb1", [:mix], [{:bamboo, "~> 2.0", [hex: :bamboo, repo: "hexpm", optional: false]}, {:ex_aws, "~> 2.4.1", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:gen_smtp, "~> 1.2.0", [hex: :gen_smtp, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "feb609b57316d335b217937f66cfc7c1ebe37ec481bebe97fcd5da5f31171808"},
"bamboo_smtp": {:hex, :bamboo_smtp, "4.2.2", "e9f57a2300df9cb496c48751bd7668a86a2b89aa2e79ccaa34e0c46a5f64c3ae", [:mix], [{:bamboo, "~> 2.2.0", [hex: :bamboo, repo: "hexpm", optional: false]}, {:gen_smtp, "~> 1.2.0", [hex: :gen_smtp, repo: "hexpm", optional: false]}], "hexpm", "28cac2ec8adaae02aed663bf68163992891a3b44cfd7ada0bebe3e09bed7207f"},
"bamboo_sparkpost": {:hex, :bamboo_sparkpost, "2.0.0", "8617642e438340186da422b7f1ec25663d1c8fa869ecaf3e5ba2524131a1b5f0", [:mix], [{:bamboo, "~> 2.0", [hex: :bamboo, repo: "hexpm", optional: false]}], "hexpm", "a89a1c29e122270e50c53c77e091d885c40bebb689f8904572c38b299649bebf"},
"bandit": {:hex, :bandit, "1.2.0", "2b5784909cc25b2514868055ff27458cdc63314514b90d86448ff91d18bece80", [:mix], [{:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "05688b883d87cc3b32991517a61e8c2ce8ee2dd6aa6eb73635426002a6661491"},
"bandit": {:hex, :bandit, "1.2.1", "aa485b4ac175065b8e0fb5864ddd5dd7b50d52336b36f61c82f484c3718b3d15", [:mix], [{:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "27393e590a407f1b7d51c5fee4737f139fe224a30449ce25061eac70f763896b"},
"basic_auth": {:hex, :basic_auth, "2.2.5", "ec2c934e4943b63cfc7d6b01c6f3fa51ade2a518ca36c9c0caee18a90bf98c4e", [:mix], [{:plug, "~> 0.14 or ~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "8b5f067bcfe48d7dc02d43c18ad9e9b54e630c2da720667ac8ed46979b54b7cb"},
"beam_file": {:hex, :beam_file, "0.5.3", "8ef6b6ab3b2981e5d67c20e635fdddab4b82d96d25fe50c26a259bafed996ead", [:mix], [], "hexpm", "f4722cc3b811b94c4941fa981e25319f7b2ae24495196fcf075208cffb9228e4"},
"benchee": {:hex, :benchee, "1.3.0", "f64e3b64ad3563fa9838146ddefb2d2f94cf5b473bdfd63f5ca4d0657bf96694", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "34f4294068c11b2bd2ebf2c59aac9c7da26ffa0068afdf3419f1b176e16c5f81"},
@ -145,6 +145,7 @@
"ex_marcel": {:hex, :ex_marcel, "0.1.0", "61116a255ed51e8d9ec65cb0018442bf37cadb2228d3bb90e3bbb6d3d11dcd34", [:mix], [], "hexpm", "48dfc497435a9c52c0e90c1e07d8ce7316a095dcec0e04d182e8250e493b72fb"},
"ex_ulid": {:hex, :ex_ulid, "0.1.0", "e6e717c57344f6e500d0190ccb4edc862b985a3680f15834af992ec065d4dcff", [:mix], [], "hexpm", "a2befd477aebc4639563de7e233e175cacf8a8f42c8f6778c88d60c13bf20860"},
"ex_unit_notifier": {:hex, :ex_unit_notifier, "1.3.0", "1d82aa6d2fb44e6f0f219142661a46e13dcba833e150e1395190d2e0fb721990", [:mix], [], "hexpm", "55fffd6062e8d962fc44e8b06fa30a87dc7251ee2a69f520781a3bb29858c365"},
"ex_unit_summary": {:hex, :ex_unit_summary, "0.1.0", "7b0352afc5e6a933c805df0a539b66b392ac12ba74d8b208db7d83f77cb57049", [:mix], [], "hexpm", "8c87d0deade3657102902251d2ec60b5b94560004ce0e2c2fa5b466232716bd6"},
"excellent_migrations": {:hex, :excellent_migrations, "0.1.6", "5ac916760cee8c63f55a2dbf3eadabb699a60adde5943ce069c1f7ee93f92963", [:mix], [{:credo, "~> 1.5", [hex: :credo, repo: "hexpm", optional: true]}], "hexpm", "c39269b0e4c0412b3e87fd77fe7ce8dd0e8470a6ec3df7d150b8d198b69a0239"},
"exdiff": {:hex, :exdiff, "0.1.5", "3e55bd840214508fd478d91fb07f1671d90d2f0d6f5266296e3b596e07d92305", [:mix], [], "hexpm", "b1ccef642edc28ed3acf1b08c8dbc6e42852d18dfe51b453529588e53c733eba"},
"expo": {:hex, :expo, "0.5.1", "249e826a897cac48f591deba863b26c16682b43711dd15ee86b92f25eafd96d9", [:mix], [], "hexpm", "68a4233b0658a3d12ee00d27d37d856b1ba48607e7ce20fd376958d0ba6ce92b"},
@ -306,7 +307,7 @@
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"},
"statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"},
"stream_data": {:hex, :stream_data, "0.6.0", "e87a9a79d7ec23d10ff83eb025141ef4915eeb09d4491f79e52f2562b73e5f47", [:mix], [], "hexpm", "b92b5031b650ca480ced047578f1d57ea6dd563f5b57464ad274718c9c29501c"},
"surface": {:hex, :surface, "0.11.1", "67fed94c1ca8e0ed2e0871beddb8be7cbb0aa9792ede5f2812ed61da438ea275", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:sourceror, "~> 0.12.0", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "5e7068f51117b7f1aa1c098a6b724b5575e663af4b8f563c5ccd9ddace639222"},
"surface": {:git, "https://github.com/surface-ui/surface", "ff39d25153c54bc459045e0b1692599721e8c64a", []},
"sweet_xml": {:hex, :sweet_xml, "0.7.4", "a8b7e1ce7ecd775c7e8a65d501bc2cd933bff3a9c41ab763f5105688ef485d08", [:mix], [], "hexpm", "e7c4b0bdbf460c928234951def54fe87edf1a170f6896675443279e2dbeba167"},
"table_rex": {:hex, :table_rex, "4.0.0", "3c613a68ebdc6d4d1e731bc973c233500974ec3993c99fcdabb210407b90959b", [:mix], [], "hexpm", "c35c4d5612ca49ebb0344ea10387da4d2afe278387d4019e4d8111e815df8f55"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},

View file

@ -2,18 +2,16 @@ import Bonfire.Common.Config, only: [repo: 0]
running_a_second_test_instance? = System.get_env("TEST_INSTANCE") == "yes"
# Start ExUnitSummary application, with recommended config
# ExUnitSummary.start(:normal, %ExUnitSummary.Config{
# filter_results: :success,
# # filter_results: :failed,
# print_delay: 100
# })
ExUnit.configure(
formatters: [
ExUnit.CLIFormatter,
ExUnitNotifier,
Bonfire.Common.TestSummary
# Bonfire.UI.Kanban.TestDrivenCoordination
]
)
# Code.put_compiler_option(:nowarn_unused_vars, true)
ExUnit.start(
# please note that Mneme overrides any custom formatters
formatters: Bonfire.Common.RuntimeConfig.test_formatters(),
#  miliseconds
timeout: 120_000,
assert_receive_timeout: 1000,
@ -22,7 +20,14 @@ ExUnit.start(
capture_log: !running_a_second_test_instance?
)
Mneme.start()
ExUnit.configuration()
|> IO.inspect()
# Code.put_compiler_option(:nowarn_unused_vars, true)
ExUnit.start()
if System.get_env("TEST_WITH_MNEME") != "no", do: Mneme.start(), else: Mneme.Options.configure([])
Mix.Task.run("ecto.create")
Mix.Task.run("ecto.migrate")
@ -63,3 +68,6 @@ if System.get_env("OBSERVE") do
Mix.ensure_application!(:observer)
:observer.start()
end
ExUnit.configuration()
|> IO.inspect()