summaryrefslogtreecommitdiff
path: root/lib/mix/tasks
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-06-19 19:04:09 -0400
committerMark Felder <feld@feld.me>2024-06-19 19:04:12 -0400
commited2976b237b53a524247d564691e0a12d3231d68 (patch)
tree0a1b2a55743c2e00f32c7549fc4bf68b0ea3c894 /lib/mix/tasks
parent3a8420b141c5186a02be702b59a3799ff65cf4f8 (diff)
downloadpleroma-ed2976b237b53a524247d564691e0a12d3231d68.tar.gz
pleroma-ed2976b237b53a524247d564691e0a12d3231d68.zip
Custom mix task to retry failed tests once in CI pipeline
This will be temporary* as we hunt down the cause of the random test failures * gonna regret this
Diffstat (limited to 'lib/mix/tasks')
-rw-r--r--lib/mix/tasks/pleroma/test_runner.ex25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/mix/tasks/pleroma/test_runner.ex b/lib/mix/tasks/pleroma/test_runner.ex
new file mode 100644
index 000000000..69fefb001
--- /dev/null
+++ b/lib/mix/tasks/pleroma/test_runner.ex
@@ -0,0 +1,25 @@
+defmodule Mix.Tasks.Pleroma.TestRunner do
+ @shortdoc "Retries tests once if they fail"
+
+ use Mix.Task
+
+ def run(args \\ []) do
+ case System.cmd("mix", ["test"] ++ args, into: IO.stream(:stdio, :line)) do
+ {_, 0} ->
+ :ok
+
+ _ ->
+ retry(args)
+ end
+ end
+
+ def retry(args) do
+ case System.cmd("mix", ["test", "--failed"] ++ args, into: IO.stream(:stdio, :line)) do
+ {_, 0} ->
+ :ok
+
+ _ ->
+ exit(1)
+ end
+ end
+end