Merge branch 'bump/min-elixir-1.10' into 'develop'

Bump minimum Elixir version to 1.10

See merge request pleroma/pleroma!3741
This commit is contained in:
tusooa 2022-09-05 15:19:34 +00:00
commit f7c2073103
15 changed files with 33 additions and 40 deletions

View File

@ -271,7 +271,7 @@ amd64:
MIX_ENV: prod MIX_ENV: prod
before_script: &before-release before_script: &before-release
- apt-get update && apt-get install -y cmake libmagic-dev - apt-get update && apt-get install -y cmake libmagic-dev
- echo "import Mix.Config" > config/prod.secret.exs - echo "import Config" > config/prod.secret.exs
- mix local.hex --force - mix local.hex --force
- mix local.rebar --force - mix local.rebar --force
script: &release script: &release
@ -290,7 +290,7 @@ amd64-musl:
variables: *release-variables variables: *release-variables
before_script: &before-release-musl before_script: &before-release-musl
- apk add git build-base cmake file-dev openssl - apk add git build-base cmake file-dev openssl
- echo "import Mix.Config" > config/prod.secret.exs - echo "import Config" > config/prod.secret.exs
- mix local.hex --force - mix local.hex --force
- mix local.rebar --force - mix local.rebar --force
script: *release script: *release

View File

@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- MastoFE - MastoFE
### Changed ### Changed
- **Breaking:** Elixir >=1.10 is now required (was >= 1.9)
- Allow users to remove their emails if instance does not need email to register - Allow users to remove their emails if instance does not need email to register
- Uploadfilter `Pleroma.Upload.Filter.Exiftool` has been renamed to `Pleroma.Upload.Filter.Exiftool.StripLocation` - Uploadfilter `Pleroma.Upload.Filter.Exiftool` has been renamed to `Pleroma.Upload.Filter.Exiftool.StripLocation`
- Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+ - Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+

View File

@ -1,11 +1,11 @@
FROM elixir:1.9-alpine as build FROM elixir:1.10-alpine as build
COPY . . COPY . .
ENV MIX_ENV=prod ENV MIX_ENV=prod
RUN apk add git gcc g++ musl-dev make cmake file-dev &&\ RUN apk add git gcc g++ musl-dev make cmake file-dev &&\
echo "import Mix.Config" > config/prod.secret.exs &&\ echo "import Config" > config/prod.secret.exs &&\
mix local.hex --force &&\ mix local.hex --force &&\
mix local.rebar --force &&\ mix local.rebar --force &&\
mix deps.get --only prod &&\ mix deps.get --only prod &&\

View File

@ -1,7 +1,8 @@
FROM elixir:1.9.4 FROM elixir:1.10.4
# Single RUN statement, otherwise intermediate images are created
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
RUN apt-get update &&\ RUN apt-get update &&\
apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\ apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\
mix local.hex --force &&\ mix local.hex --force &&\
mix local.rebar --force mix local.rebar --force

12
ci/README Normal file
View File

@ -0,0 +1,12 @@
## Dependencies
Assuming an AMD64 Alpine system, you're going to need the following packages
- `qemu qemu-openrc qemu-arm qemu-aarch64` for binfmt
- `docker-cli-buildx` for building the images
## Setting up
```
docker login git.pleroma.social:5050
doas rc-service qemu-binfmt start
```

View File

@ -37,7 +37,7 @@
# FIGURATION! EDIT YOUR SECRET FILE (either prod.secret.exs, dev.secret.exs). # FIGURATION! EDIT YOUR SECRET FILE (either prod.secret.exs, dev.secret.exs).
# #
# This file is responsible for configuring your application # This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module. # and its dependencies with the aid of the Config module.
# #
# This configuration file is loaded before any dependency and # This configuration file is loaded before any dependency and
# is restricted to this project. # is restricted to this project.

View File

@ -59,7 +59,7 @@ The configuration of Pleroma has traditionally been managed with a config file,
Here is an example of a server config stripped down after migration: Here is an example of a server config stripped down after migration:
``` ```
use Mix.Config import Config
config :pleroma, Pleroma.Web.Endpoint, config :pleroma, Pleroma.Web.Endpoint,
url: [host: "cool.pleroma.site", scheme: "https", port: 443] url: [host: "cool.pleroma.site", scheme: "https", port: 443]

View File

@ -1,7 +1,7 @@
## Required dependencies ## Required dependencies
* PostgreSQL 9.6+ * PostgreSQL 9.6+
* Elixir 1.9+ * Elixir 1.10+
* Erlang OTP 22.2+ * Erlang OTP 22.2+
* git * git
* file / libmagic * file / libmagic

View File

@ -1,2 +1,2 @@
elixir_version=1.9.4 elixir_version=1.10.4
erlang_version=22.3.4.1 erlang_version=22.3.4.1

View File

@ -304,13 +304,8 @@ defp write_config(file, path, opts) do
System.cmd("mix", ["format", path]) System.cmd("mix", ["format", path])
end end
if Code.ensure_loaded?(Config.Reader) do defp config_header, do: "import Config\r\n\r\n"
defp config_header, do: "import Config\r\n\r\n" defp read_file(config_file), do: Config.Reader.read_imports!(config_file)
defp read_file(config_file), do: Config.Reader.read_imports!(config_file)
else
defp config_header, do: "use Mix.Config\r\n\r\n"
defp read_file(config_file), do: Mix.Config.eval!(config_file)
end
defp write_and_delete(config, file, delete?) do defp write_and_delete(config, file, delete?) do
config config

View File

@ -19,21 +19,10 @@ defmodule Pleroma.Config.Loader do
:tesla :tesla
] ]
if Code.ensure_loaded?(Config.Reader) do @reader Config.Reader
@reader Config.Reader
def read(path), do: @reader.read!(path)
else
# support for Elixir less than 1.9
@reader Mix.Config
def read(path) do
path
|> @reader.eval!()
|> elem(0)
end
end
@spec read(Path.t()) :: keyword() @spec read(Path.t()) :: keyword()
def read(path), do: @reader.read!(path)
@spec merge(keyword(), keyword()) :: keyword() @spec merge(keyword(), keyword()) :: keyword()
def merge(c1, c2), do: @reader.merge(c1, c2) def merge(c1, c2), do: @reader.merge(c1, c2)

View File

@ -247,8 +247,7 @@ def cast_and_apply(%{"type" => type} = object) when type in ~w[Article Note Page
def cast_and_apply(o), do: {:error, {:validator_not_set, o}} def cast_and_apply(o), do: {:error, {:validator_not_set, o}}
# is_struct/1 appears in Elixir 1.11 def stringify_keys(object) when is_struct(object) do
def stringify_keys(%{__struct__: _} = object) do
object object
|> Map.from_struct() |> Map.from_struct()
|> stringify_keys |> stringify_keys

View File

@ -5,7 +5,7 @@ def project do
[ [
app: :pleroma, app: :pleroma,
version: version("2.4.52"), version: version("2.4.52"),
elixir: "~> 1.9", elixir: "~> 1.10",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(), compilers: [:phoenix, :gettext] ++ Mix.compilers(),
elixirc_options: [warnings_as_errors: warnings_as_errors()], elixirc_options: [warnings_as_errors: warnings_as_errors()],

View File

@ -3,11 +3,7 @@
# NOTE: This file should not be committed to a repo or otherwise made public # NOTE: This file should not be committed to a repo or otherwise made public
# without removing sensitive information. # without removing sensitive information.
<%= if Code.ensure_loaded?(Config) or not Code.ensure_loaded?(Mix.Config) do import Config
"import Config"
else
"use Mix.Config"
end %>
config :pleroma, Pleroma.Web.Endpoint, config :pleroma, Pleroma.Web.Endpoint,
url: [host: "<%= domain %>", scheme: "https", port: <%= port %>], url: [host: "<%= domain %>", scheme: "https", port: <%= port %>],

View File

@ -5,7 +5,7 @@ def project do
[ [
app: :restarter, app: :restarter,
version: "0.1.0", version: "0.1.0",
elixir: "~> 1.8", elixir: "~> 1.10",
start_permanent: Mix.env() == :prod, start_permanent: Mix.env() == :prod,
deps: deps() deps: deps()
] ]