From b1c0b9e01adcb108b5946fa0c1dc0e2330afd2f0 Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 11:49:41 +0000 Subject: [PATCH 1/9] test lowest and highest supported versions on PR --- .woodpecker/test.yml | 14 ++++++++------ ci/Dockerfile | 13 ++++++------- ci/build-all.sh | 2 ++ ci/build.sh | 3 +++ ci/build_and_push.sh | 1 - .../docs/installation/generic_dependencies.include | 2 +- mix.exs | 2 +- 7 files changed, 21 insertions(+), 16 deletions(-) create mode 100755 ci/build-all.sh create mode 100755 ci/build.sh delete mode 100755 ci/build_and_push.sh diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index bef503752..20a06eba4 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -5,16 +5,18 @@ depends_on: - lint matrix: + # test the lowest and highest versions ELIXIR_VERSION: - - 1.14 - 1.15 - - 1.16 + - 1.18 OTP_VERSION: - - 25 - - 26 + - 24 + - 27 include: - - ELIXIR_VERSION: 1.16 - OTP_VERSION: 26 + - ELIXIR_VERSION: 1.15 + OTP_VERSION: 24 + - ELIXIR_VERSION: 1.18 + OTP_VERSION: 27 variables: - &setup-hex "mix local.hex --force && mix local.rebar --force" diff --git a/ci/Dockerfile b/ci/Dockerfile index e6a8b438c..9a399efe3 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,7 +1,6 @@ -FROM elixir:1.9.4 - -RUN apt-get update &&\ - apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\ - mix local.hex --force &&\ - mix local.rebar --force - +ARG TAG +FROM docker.io/hexpm/elixir:${TAG} +RUN apk update +RUN apk add git gcc g++ musl-dev make cmake file-dev rclone wget zip imagemagick ffmpeg perl-image-exiftool exiftool +RUN mkdir /src +WORKDIR /src diff --git a/ci/build-all.sh b/ci/build-all.sh new file mode 100755 index 000000000..6aa0fd587 --- /dev/null +++ b/ci/build-all.sh @@ -0,0 +1,2 @@ +./build.sh 1.15-otp24 1.15.8-erlang-24.3.4.17-alpine-3.19.7 +./build.sh 1.18-otp27 1.18.2-erlang-27.2.4-alpine-3.19.7 diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 000000000..bf80b9208 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,3 @@ +echo "Building $1 using image tag $2" +docker build -t docker.io/akkoma/ci-base:$1 --build-arg=version=$1 --build-arg=TAG=$2 . +docker push docker.io/akkoma/ci-base:$1 diff --git a/ci/build_and_push.sh b/ci/build_and_push.sh deleted file mode 100755 index 484cc2643..000000000 --- a/ci/build_and_push.sh +++ /dev/null @@ -1 +0,0 @@ -docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:latest --push . diff --git a/docs/docs/installation/generic_dependencies.include b/docs/docs/installation/generic_dependencies.include index f4d439b83..098a7c7d8 100644 --- a/docs/docs/installation/generic_dependencies.include +++ b/docs/docs/installation/generic_dependencies.include @@ -1,7 +1,7 @@ ## Required dependencies * PostgreSQL 12+ -* Elixir 1.14+ (currently tested up to 1.17) +* Elixir 1.15+ (currently tested up to 1.18) * Erlang OTP 25+ (currently tested up to OTP27) * git * file / libmagic diff --git a/mix.exs b/mix.exs index 8ec107c49..8f16d3aac 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ def project do [ app: :pleroma, version: version("3.15.1"), - elixir: "~> 1.14", + elixir: "~> 1.15", elixirc_paths: elixirc_paths(Mix.env()), compilers: Mix.compilers(), elixirc_options: [warnings_as_errors: warnings_as_errors()], From f176294d6d1597e13b325f00d1472bd3e0c0a85f Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 11:54:00 +0000 Subject: [PATCH 2/9] elixir 1.18 formatting --- lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex | 6 +++++- lib/pleroma/web/activity_pub/mrf/simple_policy.ex | 2 +- .../web/activity_pub/object_validators/user_validator.ex | 5 ++++- lib/pleroma/web/mastodon_api/views/status_view.ex | 4 +++- lib/pleroma/workers/mailer_worker.ex | 4 +++- lib/pleroma/workers/mute_expire_worker.ex | 4 +++- lib/pleroma/workers/publisher_worker.ex | 4 +++- 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex b/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex index 627f52168..bccb1a37e 100644 --- a/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex @@ -24,7 +24,11 @@ defp score_displayname("federationbot"), do: 1.0 defp score_displayname("fedibot"), do: 1.0 defp score_displayname(_), do: 0.0 - defp determine_if_followbot(%User{nickname: nickname, name: displayname, actor_type: actor_type}) do + defp determine_if_followbot(%User{ + nickname: nickname, + name: displayname, + actor_type: actor_type + }) do # nickname will be a binary string except when following a relay nick_score = if is_binary(nickname) do diff --git a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex index 0b8b846ec..a49d75237 100644 --- a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex @@ -108,7 +108,7 @@ defp check_ftl_removal(%{host: actor_host} = _actor_info, object) do end defp intersection(list1, list2) do - list1 -- list1 -- list2 + list1 -- (list1 -- list2) end defp check_followers_only(%{host: actor_host} = _actor_info, object) do diff --git a/lib/pleroma/web/activity_pub/object_validators/user_validator.ex b/lib/pleroma/web/activity_pub/object_validators/user_validator.ex index f75e2f87e..5612ded1b 100644 --- a/lib/pleroma/web/activity_pub/object_validators/user_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/user_validator.ex @@ -34,7 +34,10 @@ def validate(%{"type" => type, "id" => _id} = data, meta) def validate(_, _), do: {:error, "Not a user object"} - defp validate_pubkey(%{"id" => user_id, "publicKey" => %{"id" => pk_id, "publicKeyPem" => _key}}) do + defp validate_pubkey(%{ + "id" => user_id, + "publicKey" => %{"id" => pk_id, "publicKeyPem" => _key} + }) do with {_, true} <- {:user, is_binary(user_id)}, {_, true} <- {:key, is_binary(pk_id)}, :ok <- Containment.contain_key_user(pk_id, user_id) do diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index a5229f5e4..65aeecfcf 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -617,7 +617,9 @@ def render("context.json", %{activity: activity, activities: activities, user: u %{ancestors: ancestors, descendants: descendants} = activities |> Enum.reverse() - |> Enum.group_by(fn %{id: id} -> if id < activity.id, do: :ancestors, else: :descendants end) + |> Enum.group_by(fn %{id: id} -> + if id < activity.id, do: :ancestors, else: :descendants + end) |> Map.put_new(:ancestors, []) |> Map.put_new(:descendants, []) diff --git a/lib/pleroma/workers/mailer_worker.ex b/lib/pleroma/workers/mailer_worker.ex index 592230e7a..48c3fc9d1 100644 --- a/lib/pleroma/workers/mailer_worker.ex +++ b/lib/pleroma/workers/mailer_worker.ex @@ -6,7 +6,9 @@ defmodule Pleroma.Workers.MailerWorker do use Pleroma.Workers.WorkerHelper, queue: "mailer" @impl Oban.Worker - def perform(%Job{args: %{"op" => "email", "encoded_email" => encoded_email, "config" => config}}) do + def perform(%Job{ + args: %{"op" => "email", "encoded_email" => encoded_email, "config" => config} + }) do encoded_email |> Base.decode64!() |> :erlang.binary_to_term() diff --git a/lib/pleroma/workers/mute_expire_worker.ex b/lib/pleroma/workers/mute_expire_worker.ex index 8da903e76..c253027d9 100644 --- a/lib/pleroma/workers/mute_expire_worker.ex +++ b/lib/pleroma/workers/mute_expire_worker.ex @@ -6,7 +6,9 @@ defmodule Pleroma.Workers.MuteExpireWorker do use Pleroma.Workers.WorkerHelper, queue: "mute_expire" @impl Oban.Worker - def perform(%Job{args: %{"op" => "unmute_user", "muter_id" => muter_id, "mutee_id" => mutee_id}}) do + def perform(%Job{ + args: %{"op" => "unmute_user", "muter_id" => muter_id, "mutee_id" => mutee_id} + }) do Pleroma.User.unmute(muter_id, mutee_id) :ok end diff --git a/lib/pleroma/workers/publisher_worker.ex b/lib/pleroma/workers/publisher_worker.ex index 545887071..be94134b9 100644 --- a/lib/pleroma/workers/publisher_worker.ex +++ b/lib/pleroma/workers/publisher_worker.ex @@ -13,7 +13,9 @@ def backoff(%Job{attempt: attempt}) when is_integer(attempt) do end @impl Oban.Worker - def perform(%Job{args: %{"op" => "publish", "activity_id" => activity_id, "object_data" => nil}}) do + def perform(%Job{ + args: %{"op" => "publish", "activity_id" => activity_id, "object_data" => nil} + }) do activity = Activity.get_by_id(activity_id) Federator.perform(:publish, activity) end From 842414b9274553cb740517dc1ec51ed50fe4cb94 Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 11:56:15 +0000 Subject: [PATCH 3/9] run the lint task on the latest version --- .woodpecker/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/lint.yml b/.woodpecker/lint.yml index 70e8fc95d..632465fa4 100644 --- a/.woodpecker/lint.yml +++ b/.woodpecker/lint.yml @@ -40,7 +40,7 @@ variables: steps: lint: - image: akkoma/ci-base:1.16-otp26 + image: akkoma/ci-base:1.18-otp27 <<: *on-pr-open environment: MIX_ENV: test From 829af03042fe69d70615dcb76fc0a4f8958d1b21 Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 12:19:14 +0000 Subject: [PATCH 4/9] we don't support otp24, bump to 25 --- .woodpecker/test.yml | 4 ++-- ci/build-all.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index 20a06eba4..2b8d495bc 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -10,11 +10,11 @@ matrix: - 1.15 - 1.18 OTP_VERSION: - - 24 + - 25 - 27 include: - ELIXIR_VERSION: 1.15 - OTP_VERSION: 24 + OTP_VERSION: 25 - ELIXIR_VERSION: 1.18 OTP_VERSION: 27 diff --git a/ci/build-all.sh b/ci/build-all.sh index 6aa0fd587..854a0092f 100755 --- a/ci/build-all.sh +++ b/ci/build-all.sh @@ -1,2 +1,2 @@ -./build.sh 1.15-otp24 1.15.8-erlang-24.3.4.17-alpine-3.19.7 +./build.sh 1.15-otp25 1.15.8-erlang-25.3.2.18-alpine-3.19.7 ./build.sh 1.18-otp27 1.18.2-erlang-27.2.4-alpine-3.19.7 From 184c62359fab3bbddda19c6f10c65c77b7a31b74 Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 13:04:10 +0000 Subject: [PATCH 5/9] drop back to 1.14/OTP25 --- .woodpecker/test.yml | 4 ++-- ci/build-all.sh | 1 + config/config.exs | 1 + docs/docs/installation/generic_dependencies.include | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index 2b8d495bc..f4044000c 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -7,13 +7,13 @@ depends_on: matrix: # test the lowest and highest versions ELIXIR_VERSION: - - 1.15 + - 1.14 - 1.18 OTP_VERSION: - 25 - 27 include: - - ELIXIR_VERSION: 1.15 + - ELIXIR_VERSION: 1.14 OTP_VERSION: 25 - ELIXIR_VERSION: 1.18 OTP_VERSION: 27 diff --git a/ci/build-all.sh b/ci/build-all.sh index 854a0092f..8d3132637 100755 --- a/ci/build-all.sh +++ b/ci/build-all.sh @@ -1,2 +1,3 @@ +./build.sh 1.14-otp25 1.14.3-erlang-25.3.2-alpine-3.18.0 ./build.sh 1.15-otp25 1.15.8-erlang-25.3.2.18-alpine-3.19.7 ./build.sh 1.18-otp27 1.18.2-erlang-27.2.4-alpine-3.19.7 diff --git a/config/config.exs b/config/config.exs index be6a0d81c..f19f6fa76 100644 --- a/config/config.exs +++ b/config/config.exs @@ -558,6 +558,7 @@ ], email_blacklist: [] +config :oban_met, auto_start: false config :pleroma, Oban, repo: Pleroma.Repo, log: false, diff --git a/docs/docs/installation/generic_dependencies.include b/docs/docs/installation/generic_dependencies.include index 098a7c7d8..9e75a0151 100644 --- a/docs/docs/installation/generic_dependencies.include +++ b/docs/docs/installation/generic_dependencies.include @@ -1,7 +1,7 @@ ## Required dependencies * PostgreSQL 12+ -* Elixir 1.15+ (currently tested up to 1.18) +* Elixir 1.14.1+ (currently tested up to 1.18) * Erlang OTP 25+ (currently tested up to OTP27) * git * file / libmagic From 8e789c62365a1c11eb0f0c1b51f2b67710f99fee Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 13:07:03 +0000 Subject: [PATCH 6/9] 1.14.1 min version --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 8f16d3aac..23c7beab3 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ def project do [ app: :pleroma, version: version("3.15.1"), - elixir: "~> 1.15", + elixir: "~> 1.14.1", elixirc_paths: elixirc_paths(Mix.env()), compilers: Mix.compilers(), elixirc_options: [warnings_as_errors: warnings_as_errors()], From 41a4ed1db5601c4da061925fce8df54ed601d7ae Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 13:17:52 +0000 Subject: [PATCH 7/9] specify correct version --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 23c7beab3..ba89b11f4 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ def project do [ app: :pleroma, version: version("3.15.1"), - elixir: "~> 1.14.1", + elixir: "~> 1.14.1 or ~> 1.15", elixirc_paths: elixirc_paths(Mix.env()), compilers: Mix.compilers(), elixirc_options: [warnings_as_errors: warnings_as_errors()], From 93200a80731595c94d4b308907cf300aac15896c Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 13:36:14 +0000 Subject: [PATCH 8/9] use latest ASDF instructions --- config/config.exs | 1 + docs/docs/installation/debian_based_en.md | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/config.exs b/config/config.exs index f19f6fa76..e60b2db3a 100644 --- a/config/config.exs +++ b/config/config.exs @@ -559,6 +559,7 @@ email_blacklist: [] config :oban_met, auto_start: false + config :pleroma, Oban, repo: Pleroma.Repo, log: false, diff --git a/docs/docs/installation/debian_based_en.md b/docs/docs/installation/debian_based_en.md index 442849e69..ba9ee3bd4 100644 --- a/docs/docs/installation/debian_based_en.md +++ b/docs/docs/installation/debian_based_en.md @@ -61,15 +61,15 @@ Next install Erlang: ```shell asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac" -asdf install erlang 26.2.5.4 -asdf global erlang 26.2.5.4 +asdf install erlang 27.2.4 +asdf set erlang 27.2.4 ``` Now install Elixir: ```shell -asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git -asdf install elixir 1.17.3-otp-26 -asdf global elixir 1.17.3-otp-26 +asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git +asdf install elixir 1.18.2-otp-27 +asdf set elixir 1.18.2-otp-27 ``` Confirm that Elixir is installed correctly by checking the version: From 4a05b2d64393d21e0902a90bd85ed2d752746691 Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Sun, 2 Mar 2025 13:36:52 +0000 Subject: [PATCH 9/9] we do actually want to start oban-met... --- config/config.exs | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/config.exs b/config/config.exs index e60b2db3a..be6a0d81c 100644 --- a/config/config.exs +++ b/config/config.exs @@ -558,8 +558,6 @@ ], email_blacklist: [] -config :oban_met, auto_start: false - config :pleroma, Oban, repo: Pleroma.Repo, log: false,