From c29550482d3a9cc2ab1c588fec07ffc6a87d5480 Mon Sep 17 00:00:00 2001 From: Leo Amigud Date: Fri, 20 Oct 2023 21:23:49 +0200 Subject: [PATCH] Added Build Pulse integration --- .github/workflows/main.yaml | 10 ++++++++++ config/config.exs | 7 +++++++ mix.exs | 3 ++- mix.lock | 1 + .../migrations/20230202195025_add_username_column.exs | 2 -- test/test_helper.exs | 1 + tmp/.keep | 0 7 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tmp/.keep diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 14351ef..f3ced5a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -118,6 +118,16 @@ jobs: # Step: Execute the tests. - name: Run tests run: mix test + + - name: Upload Test Results to BuildPulse for Flaky Test Detection + if: '!cancelled()' # Run this step even when the tests fail. Skip if the workflow is cancelled. + uses: Workshop64/buildpulse-action@master + with: + account: 1671508 # Replace this value with your BuildPulse account ID + repository: 585572389 # Replace this value with your BuildPulse repository ID + path: tmp/ + key: ${{ secrets.BUILDPULSE_ACCESS_KEY_ID }} + secret: ${{ secrets.BUILDPULSE_SECRET_ACCESS_KEY }} deploy: name: Deploy app needs: [dialyzer, test] diff --git a/config/config.exs b/config/config.exs index 71393cb..4e88163 100644 --- a/config/config.exs +++ b/config/config.exs @@ -7,6 +7,13 @@ # General application configuration import Config +config :junit_formatter, + report_file: "test_report.xml", + report_dir: "./tmp", + print_report_file: true, + prepend_project_name?: true, + include_filename?: true + config :alternis, game_engine: Alternis.Engines.GameEngine.Impl config :alternis, match_engine: Alternis.Engines.MatchEngine.WordleImpl config :alternis, dictionary_engine: Alternis.Engines.DictionaryEngine.Impl diff --git a/mix.exs b/mix.exs index 60dad81..5e81376 100644 --- a/mix.exs +++ b/mix.exs @@ -68,7 +68,8 @@ defmodule Alternis.MixProject do {:ecto_erd, "~> 0.5", only: :dev}, {:recase, "~> 0.5"}, {:phoenix_view, "~> 2.0.2"}, - {:faker, "~> 0.17.0"} + {:faker, "~> 0.17.0"}, + {:junit_formatter, "~> 3.3", only: [:test]} ] end diff --git a/mix.lock b/mix.lock index d5f1f94..2212ce7 100644 --- a/mix.lock +++ b/mix.lock @@ -38,6 +38,7 @@ "html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, + "junit_formatter": {:hex, :junit_formatter, "3.3.1", "c729befb848f1b9571f317d2fefa648e9d4869befc4b2980daca7c1edc468e40", [:mix], [], "hexpm", "761fc5be4b4c15d8ba91a6dafde0b2c2ae6db9da7b8832a55b5a1deb524da72b"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, diff --git a/priv/repo/migrations/20230202195025_add_username_column.exs b/priv/repo/migrations/20230202195025_add_username_column.exs index c683023..63574f4 100644 --- a/priv/repo/migrations/20230202195025_add_username_column.exs +++ b/priv/repo/migrations/20230202195025_add_username_column.exs @@ -1,8 +1,6 @@ defmodule Alternis.Repo.Migrations.AddUsernameColumn do use Ecto.Migration - alias Alternis.Accounts.User - def change do alter table(:users) do add :username, :citext, null: false, default: "" diff --git a/test/test_helper.exs b/test/test_helper.exs index 6245296..4085965 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,4 +1,5 @@ {:ok, _} = Application.ensure_all_started(:ex_machina) +ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter]) ExUnit.start() Ecto.Adapters.SQL.Sandbox.mode(Alternis.Repo, :manual) diff --git a/tmp/.keep b/tmp/.keep new file mode 100644 index 0000000..e69de29