From e23672d82f0a6e61bf4ada65cfca6cfbc647710d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 8 Nov 2023 12:21:34 -0500 Subject: [PATCH] Ensure benchee doesn't run unless we are executing benchmarks --- .../mix/tasks/pleroma/benchmark.ex | 16 ++++++++++++++-- changelog.d/benchee.skip | 0 mix.exs | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) rename {lib => benchmarks}/mix/tasks/pleroma/benchmark.ex (93%) create mode 100644 changelog.d/benchee.skip diff --git a/lib/mix/tasks/pleroma/benchmark.ex b/benchmarks/mix/tasks/pleroma/benchmark.ex similarity index 93% rename from lib/mix/tasks/pleroma/benchmark.ex rename to benchmarks/mix/tasks/pleroma/benchmark.ex index f32492169..42b28478d 100644 --- a/lib/mix/tasks/pleroma/benchmark.ex +++ b/benchmarks/mix/tasks/pleroma/benchmark.ex @@ -3,8 +3,20 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Benchmark do - import Mix.Pleroma + @shortdoc "Benchmarks" + @moduledoc """ + Benchmark tasks available: + + adapters + render_timeline + search + tag + + MIX_ENV=benchmark mix pleroma.benchmark adapters + """ + use Mix.Task + import Mix.Pleroma def run(["search"]) do start_pleroma() @@ -63,7 +75,7 @@ defmodule Mix.Tasks.Pleroma.Benchmark do Benchee.run( %{ - "Standart rendering" => fn activities -> + "Standard rendering" => fn activities -> Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{ activities: activities, for: user, diff --git a/changelog.d/benchee.skip b/changelog.d/benchee.skip new file mode 100644 index 000000000..e69de29bb diff --git a/mix.exs b/mix.exs index 3c1ce1f7e..e4c14fc9f 100644 --- a/mix.exs +++ b/mix.exs @@ -176,7 +176,6 @@ defmodule Pleroma.Mixfile do {:prometheus_ecto, "~> 1.4"}, {:recon, "~> 2.5"}, {:joken, "~> 2.0"}, - {:benchee, "~> 1.0"}, {:pot, "~> 1.0"}, {:ex_const, "~> 0.2"}, {:plug_static_index_html, "~> 1.0.0"}, @@ -202,7 +201,8 @@ defmodule Pleroma.Mixfile do {:covertool, "~> 2.0", only: :test}, {:hackney, "~> 1.18.0", override: true}, {:mox, "~> 1.0", only: :test}, - {:websockex, "~> 0.4.3", only: :test} + {:websockex, "~> 0.4.3", only: :test}, + {:benchee, "~> 1.0", only: :benchmark} ] ++ oauth_deps() end