Merge pull request 'Test lowest and highest language versions, elixir 1.18 support' (#875) from ci-testing-all-versions into develop
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test/1 Pipeline was successful
ci/woodpecker/push/test/2 Pipeline was successful
ci/woodpecker/push/build-amd64 Pipeline failed
ci/woodpecker/push/build-arm64 Pipeline failed
ci/woodpecker/push/docs unknown status

Reviewed-on: #875
This commit is contained in:
floatingghost 2025-03-11 20:47:54 +00:00
commit 0a9cf8fa8b
16 changed files with 49 additions and 28 deletions

View file

@ -40,7 +40,7 @@ variables:
steps: steps:
lint: lint:
image: akkoma/ci-base:1.16-otp26 image: akkoma/ci-base:1.18-otp27
<<: *on-pr-open <<: *on-pr-open
environment: environment:
MIX_ENV: test MIX_ENV: test

View file

@ -5,16 +5,18 @@ depends_on:
- lint - lint
matrix: matrix:
# test the lowest and highest versions
ELIXIR_VERSION: ELIXIR_VERSION:
- 1.14 - 1.14
- 1.15 - 1.18
- 1.16
OTP_VERSION: OTP_VERSION:
- 25 - 25
- 26 - 27
include: include:
- ELIXIR_VERSION: 1.16 - ELIXIR_VERSION: 1.14
OTP_VERSION: 26 OTP_VERSION: 25
- ELIXIR_VERSION: 1.18
OTP_VERSION: 27
variables: variables:
- &setup-hex "mix local.hex --force && mix local.rebar --force" - &setup-hex "mix local.hex --force && mix local.rebar --force"

View file

@ -1,7 +1,6 @@
FROM elixir:1.9.4 ARG TAG
FROM docker.io/hexpm/elixir:${TAG}
RUN apt-get update &&\ RUN apk update
apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\ RUN apk add git gcc g++ musl-dev make cmake file-dev rclone wget zip imagemagick ffmpeg perl-image-exiftool exiftool
mix local.hex --force &&\ RUN mkdir /src
mix local.rebar --force WORKDIR /src

3
ci/build-all.sh Executable file
View file

@ -0,0 +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

3
ci/build.sh Executable file
View file

@ -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

View file

@ -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 .

View file

@ -61,15 +61,15 @@ Next install Erlang:
```shell ```shell
asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac" export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
asdf install erlang 26.2.5.4 asdf install erlang 27.2.4
asdf global erlang 26.2.5.4 asdf set erlang 27.2.4
``` ```
Now install Elixir: Now install Elixir:
```shell ```shell
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf install elixir 1.17.3-otp-26 asdf install elixir 1.18.2-otp-27
asdf global elixir 1.17.3-otp-26 asdf set elixir 1.18.2-otp-27
``` ```
Confirm that Elixir is installed correctly by checking the version: Confirm that Elixir is installed correctly by checking the version:

View file

@ -1,7 +1,7 @@
## Required dependencies ## Required dependencies
* PostgreSQL 12+ * PostgreSQL 12+
* Elixir 1.14+ (currently tested up to 1.17) * Elixir 1.14.1+ (currently tested up to 1.18)
* Erlang OTP 25+ (currently tested up to OTP27) * Erlang OTP 25+ (currently tested up to OTP27)
* git * git
* file / libmagic * file / libmagic

View file

@ -24,7 +24,11 @@ defp score_displayname("federationbot"), do: 1.0
defp score_displayname("fedibot"), do: 1.0 defp score_displayname("fedibot"), do: 1.0
defp score_displayname(_), do: 0.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 # nickname will be a binary string except when following a relay
nick_score = nick_score =
if is_binary(nickname) do if is_binary(nickname) do

View file

@ -108,7 +108,7 @@ defp check_ftl_removal(%{host: actor_host} = _actor_info, object) do
end end
defp intersection(list1, list2) do defp intersection(list1, list2) do
list1 -- list1 -- list2 list1 -- (list1 -- list2)
end end
defp check_followers_only(%{host: actor_host} = _actor_info, object) do defp check_followers_only(%{host: actor_host} = _actor_info, object) do

View file

@ -34,7 +34,10 @@ def validate(%{"type" => type, "id" => _id} = data, meta)
def validate(_, _), do: {:error, "Not a user object"} 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)}, with {_, true} <- {:user, is_binary(user_id)},
{_, true} <- {:key, is_binary(pk_id)}, {_, true} <- {:key, is_binary(pk_id)},
:ok <- Containment.contain_key_user(pk_id, user_id) do :ok <- Containment.contain_key_user(pk_id, user_id) do

View file

@ -617,7 +617,9 @@ def render("context.json", %{activity: activity, activities: activities, user: u
%{ancestors: ancestors, descendants: descendants} = %{ancestors: ancestors, descendants: descendants} =
activities activities
|> Enum.reverse() |> 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(:ancestors, [])
|> Map.put_new(:descendants, []) |> Map.put_new(:descendants, [])

View file

@ -6,7 +6,9 @@ defmodule Pleroma.Workers.MailerWorker do
use Pleroma.Workers.WorkerHelper, queue: "mailer" use Pleroma.Workers.WorkerHelper, queue: "mailer"
@impl Oban.Worker @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 encoded_email
|> Base.decode64!() |> Base.decode64!()
|> :erlang.binary_to_term() |> :erlang.binary_to_term()

View file

@ -6,7 +6,9 @@ defmodule Pleroma.Workers.MuteExpireWorker do
use Pleroma.Workers.WorkerHelper, queue: "mute_expire" use Pleroma.Workers.WorkerHelper, queue: "mute_expire"
@impl Oban.Worker @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) Pleroma.User.unmute(muter_id, mutee_id)
:ok :ok
end end

View file

@ -13,7 +13,9 @@ def backoff(%Job{attempt: attempt}) when is_integer(attempt) do
end end
@impl Oban.Worker @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) activity = Activity.get_by_id(activity_id)
Federator.perform(:publish, activity) Federator.perform(:publish, activity)
end end

View file

@ -5,7 +5,7 @@ def project do
[ [
app: :pleroma, app: :pleroma,
version: version("3.15.1"), version: version("3.15.1"),
elixir: "~> 1.14", elixir: "~> 1.14.1 or ~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(), compilers: Mix.compilers(),
elixirc_options: [warnings_as_errors: warnings_as_errors()], elixirc_options: [warnings_as_errors: warnings_as_errors()],