Merge pull request 'Test lowest and highest language versions, elixir 1.18 support' (#875) from ci-testing-all-versions into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/875
This commit is contained in:
		
						commit
						0a9cf8fa8b
					
				
					 16 changed files with 49 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
    - 27
 | 
			
		||||
  include:
 | 
			
		||||
    - ELIXIR_VERSION: 1.16
 | 
			
		||||
      OTP_VERSION: 26
 | 
			
		||||
    - ELIXIR_VERSION: 1.14
 | 
			
		||||
      OTP_VERSION: 25
 | 
			
		||||
    - ELIXIR_VERSION: 1.18
 | 
			
		||||
      OTP_VERSION: 27
 | 
			
		||||
 | 
			
		||||
variables:
 | 
			
		||||
  - &setup-hex "mix local.hex --force && mix local.rebar --force"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								ci/build-all.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								ci/build-all.sh
									
									
									
									
									
										Executable 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
									
								
							
							
						
						
									
										3
									
								
								ci/build.sh
									
									
									
									
									
										Executable 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
 | 
			
		||||
| 
						 | 
				
			
			@ -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 .
 | 
			
		||||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
## Required dependencies
 | 
			
		||||
 | 
			
		||||
* 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)
 | 
			
		||||
* git
 | 
			
		||||
* file / libmagic
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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, [])
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								mix.exs
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								mix.exs
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -5,7 +5,7 @@ def project do
 | 
			
		|||
    [
 | 
			
		||||
      app: :pleroma,
 | 
			
		||||
      version: version("3.15.1"),
 | 
			
		||||
      elixir: "~> 1.14",
 | 
			
		||||
      elixir: "~> 1.14.1 or ~> 1.15",
 | 
			
		||||
      elixirc_paths: elixirc_paths(Mix.env()),
 | 
			
		||||
      compilers: Mix.compilers(),
 | 
			
		||||
      elixirc_options: [warnings_as_errors: warnings_as_errors()],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue