mix.exs 10.7 KB
Newer Older
Thomas Citharel's avatar
Thomas Citharel committed
1
defmodule Mobilizon.Mixfile do
Thomas Citharel's avatar
Thomas Citharel committed
2
3
  use Mix.Project

Thomas Citharel's avatar
Thomas Citharel committed
4
  @version "2.1.0"
Thomas Citharel's avatar
Thomas Citharel committed
5

Thomas Citharel's avatar
Thomas Citharel committed
6
7
  def project do
    [
Thomas Citharel's avatar
Thomas Citharel committed
8
      app: :mobilizon,
Thomas Citharel's avatar
Thomas Citharel committed
9
      version: @version,
10
      elixir: "~> 1.12",
Thomas Citharel's avatar
Thomas Citharel committed
11
      elixirc_paths: elixirc_paths(Mix.env()),
Thomas Citharel's avatar
Thomas Citharel committed
12
      compilers: [:gettext] ++ Mix.compilers(),
Thomas Citharel's avatar
Thomas Citharel committed
13
      xref: [exclude: [:eldap]],
Thomas Citharel's avatar
Thomas Citharel committed
14
      start_permanent: Mix.env() == :prod,
Thomas Citharel's avatar
Thomas Citharel committed
15
      aliases: aliases(),
Thomas Citharel's avatar
Thomas Citharel committed
16
17
      deps: deps(),
      test_coverage: [tool: ExCoveralls],
18
      dialyzer: [plt_add_apps: [:mix]],
Thomas Citharel's avatar
Thomas Citharel committed
19
20
21
22
      preferred_cli_env: [
        coveralls: :test,
        "coveralls.detail": :test,
        "coveralls.post": :test,
Thomas Citharel's avatar
Thomas Citharel committed
23
        "coveralls.html": :test
Thomas Citharel's avatar
Thomas Citharel committed
24
      ],
Thomas Citharel's avatar
Thomas Citharel committed
25
      name: "Mobilizon",
26
27
      source_url: "https://framagit.org/framasoft/mobilizon",
      homepage_url: "https://joinmobilizon.org",
28
29
30
      docs: docs(),
      releases: [
        mobilizon: [
31
          include_executables_for: [:unix],
32
          applications: [eldap: :transient],
33
34
          config_providers: [{Mobilizon.ConfigProvider, "/etc/mobilizon/config.exs"}],
          steps: [:assemble, &copy_files/1, &copy_config/1]
35
        ]
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
      ],
      unused: [
        ignore: [
          Mobilizon.Storage.PostgresTypes,
          Mobilizon.Factory,
          Mobilizon.Web.Router.Helpers,
          Mobilizon.Web.Email.Mailer,
          Mobilizon.Web.Auth.Guardian.Plug,
          Mobilizon.Web.Gettext,
          Mobilizon.Web.Endpoint,
          Mobilizon.Web.Auth.Guardian,
          Mobilizon.Web,
          Mobilizon.GraphQL.Schema.Compiled,
          Mobilizon.GraphQL.Schema,
          Mobilizon.Web.Router,
          Mobilizon.Users.Setting.Location,
          {:_, :start_link, 1},
          {:_, :child_spec, 1},
          {:_, :__impl__, 1},
          {:_, :__schema__, :_},
          {:_, :__struct__, 0..1},
          {:_, :__changeset__, 0},
          {:_, :create_type, 0},
          {:_, :drop_type, 0},
          {:_, :schema, 0},
          {:_, :schemaless_type, 0},
          {:_, :valid_value?, 0..1},
          {:_, :__enum_map__, 0},
          {:_, :__absinthe_blueprint__, :_},
          {:_, :__absinthe_function__, :_},
          {~r/^Mobilizon.Web.*Controller/, :_, 2},
          {~r/^Mobilizon.Web.*View/, :_, :_},
          {~r/^Mobilizon.Web.Email.*/, :render, 3},
          {~r/^Mobilizon.Service.HTTP.*Client/, :_, :_},
          {~r/^Mobilizon.Cldr.*/, :_, :_},
          {Mobilizon.Web.GraphQLSocket, :__channel__, 1}
        ]
73
      ]
Thomas Citharel's avatar
Thomas Citharel committed
74
75
76
77
78
79
80
81
    ]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [
82
      mod: {Mobilizon, []},
83
      extra_applications: [:logger, :runtime_tools, :guardian, :geolix, :crypto, :cachex]
Thomas Citharel's avatar
Thomas Citharel committed
84
85
86
    ]
  end

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  def copy_files(%{path: target_path} = release) do
    File.cp_r!("./rel/overlays", target_path)
    release
  end

  def copy_config(%{path: target_path} = release) do
    support_path = Path.join([target_path, "support"])
    File.mkdir!(support_path)

    File.cp_r!(
      "./support",
      support_path
    )

    release
  end

Thomas Citharel's avatar
Thomas Citharel committed
104
105
  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
106
  defp elixirc_paths(:dev), do: ["lib", "test/support/factory.ex"]
Thomas Citharel's avatar
Thomas Citharel committed
107
  defp elixirc_paths(_), do: ["lib"]
Thomas Citharel's avatar
Thomas Citharel committed
108

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  # Specifies OAuth dependencies.
  defp oauth_deps do
    oauth_strategy_packages =
      System.get_env("OAUTH_CONSUMER_STRATEGIES")
      |> to_string()
      |> String.split()
      |> Enum.map(fn strategy_entry ->
        with [_strategy, dependency] <- String.split(strategy_entry, ":") do
          dependency
        else
          [strategy] -> "ueberauth_#{strategy}"
        end
      end)

    for s <- oauth_strategy_packages, do: {String.to_atom(s), ">= 0.0.0"}
  end

Thomas Citharel's avatar
Thomas Citharel committed
126
127
128
129
130
  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [
Thomas Citharel's avatar
Thomas Citharel committed
131
      {:phoenix, "~> 1.6.0"},
132
      {:phoenix_pubsub, "~> 2.0"},
133
      {:phoenix_ecto, "~> 4.0"},
Thomas Citharel's avatar
Thomas Citharel committed
134
      {:postgrex, ">= 0.15.3"},
Thomas Citharel's avatar
Thomas Citharel committed
135
      {:phoenix_html, "~> 3.0"},
Thomas Citharel's avatar
Thomas Citharel committed
136
      {:phoenix_live_view, "~> 0.17.1"},
Thomas Citharel's avatar
Thomas Citharel committed
137
      {:gettext, "~> 0.11"},
138
      {:cowboy, "~> 2.6"},
Thomas Citharel's avatar
Thomas Citharel committed
139
      {:guardian, "~> 2.0"},
Thomas Citharel's avatar
Thomas Citharel committed
140
      {:guardian_db, "~> 2.1.0"},
141
      {:guardian_phoenix, "~> 2.0"},
Thomas Citharel's avatar
Thomas Citharel committed
142
143
      {:argon2_elixir, "~> 3.0"},
      {:cors_plug, "~> 3.0"},
Thomas Citharel's avatar
Thomas Citharel committed
144
      {:ecto_autoslug_field, "~> 3.0"},
Thomas Citharel's avatar
Thomas Citharel committed
145
      {:geo, "~> 3.0"},
146
      {:geo_postgis, "~> 3.1"},
147
      {:timex, "~> 3.0"},
148
      {:icalendar, github: "tcitworld/icalendar"},
149
      {:exgravatar, "~> 2.0.1"},
150
151
      # {:json_ld, "~> 0.3"},
      {:jason, "~> 1.2"},
Thomas Citharel's avatar
Thomas Citharel committed
152
      {:ecto_enum, "~> 1.4"},
Thomas Citharel's avatar
Thomas Citharel committed
153
      {:ex_ical, "~> 0.2"},
154
155
156
      {:swoosh, "~> 1.6"},
      {:gen_smtp, "~> 1.1"},
      {:phoenix_swoosh, "~> 1.0"},
Thomas Citharel's avatar
Thomas Citharel committed
157
158
      {:geolix, "~> 2.0"},
      {:geolix_adapter_mmdb2, "~> 0.6.0"},
Thomas Citharel's avatar
Thomas Citharel committed
159
      {:absinthe, "~> 1.6"},
Thomas Citharel's avatar
Thomas Citharel committed
160
      {:absinthe_phoenix, "~> 2.0.1"},
161
      {:absinthe_plug, "~> 1.5.0"},
Thomas Citharel's avatar
Thomas Citharel committed
162
      {:dataloader, "~> 1.0.6"},
163
      {:plug_cowboy, "~> 2.0"},
Thomas Citharel's avatar
Thomas Citharel committed
164
      {:atomex, "~> 0.4"},
165
      {:cachex, "~> 3.1"},
Thomas Citharel's avatar
Thomas Citharel committed
166
      {:geohax, "~> 0.4.0"},
Thomas Citharel's avatar
Thomas Citharel committed
167
      {:mogrify, "~> 0.9"},
Thomas Citharel's avatar
Thomas Citharel committed
168
169
      {:linkify, "~> 0.3"},
      {:http_signatures, "~> 0.1.0"},
Thomas Citharel's avatar
Thomas Citharel committed
170
      {:ex_cldr, "~> 2.29.0"},
Thomas Citharel's avatar
Thomas Citharel committed
171
      {:ex_cldr_dates_times, "~> 2.2"},
Thomas Citharel's avatar
Thomas Citharel committed
172
      {:ex_cldr_plugs, "~> 1.0"},
173
      {:ex_optimizer, "~> 0.1"},
174
      {:progress_bar, "~> 2.0"},
Thomas Citharel's avatar
Thomas Citharel committed
175
      {:oban, "~> 2.2"},
Thomas Citharel's avatar
Thomas Citharel committed
176
      {:floki, "~> 0.31"},
177
178
      {:ip_reserved, "~> 0.1.0"},
      {:fast_sanitize, "~> 0.1"},
179
      {:ueberauth, "~> 0.7"},
Thomas Citharel's avatar
Thomas Citharel committed
180
      {:ueberauth_twitter, "~> 0.4"},
181
182
183
      {:ueberauth_github, "~> 0.8.1"},
      {:ueberauth_facebook, "~> 0.9"},
      {:ueberauth_google, "~> 0.10.1"},
184
185
      {:ueberauth_keycloak_strategy, "~> 0.3.0"},
      {:ueberauth_gitlab_strategy, "~> 0.4.0"},
Thomas Citharel's avatar
Thomas Citharel committed
186
      {:ueberauth_cas, "~> 2.0"},
Thomas Citharel's avatar
Thomas Citharel committed
187
      {:ecto_shortuuid, "~> 0.1"},
Thomas Citharel's avatar
Thomas Citharel committed
188
      {:tesla, "~> 1.4.0"},
Thomas Citharel's avatar
Thomas Citharel committed
189
190
      {:sitemapper, "~> 0.6"},
      {:xml_builder, "~> 2.2"},
Thomas Citharel's avatar
Thomas Citharel committed
191
      {:remote_ip, "~> 1.0.0"},
Thomas Citharel's avatar
Thomas Citharel committed
192
      {:ex_cldr_languages, "~> 0.3.0"},
193
      {:slugger, "~> 0.3"},
Thomas Citharel's avatar
Thomas Citharel committed
194
      {:sentry, "~> 8.0"},
195
      {:html_entities, "~> 0.5"},
Thomas Citharel's avatar
Thomas Citharel committed
196
      {:sweet_xml, "~> 0.7"},
197
      {:web_push_encryption, github: "danhper/elixir-web-push-encryption"},
Thomas Citharel's avatar
Thomas Citharel committed
198
      {:eblurhash, "~> 1.2.0"},
199
      {:struct_access, "~> 1.1.2"},
200
      {:paasaa, "~> 0.5.0"},
201
202
      {:nimble_csv, "~> 1.1"},
      {:export, "~> 0.1.0"},
Thomas Citharel's avatar
Thomas Citharel committed
203
      {:tz_world, "~> 1.0"},
Thomas Citharel's avatar
Thomas Citharel committed
204
      {:tzdata, "~> 1.1"},
205
      {:codepagex, "~> 0.1.6"},
206
      # Dev and test dependencies
Thomas Citharel's avatar
Thomas Citharel committed
207
      {:phoenix_live_reload, "~> 1.2", only: [:dev, :e2e]},
Thomas Citharel's avatar
Thomas Citharel committed
208
      {:ex_machina, "~> 2.3", only: [:dev, :test]},
Thomas Citharel's avatar
Thomas Citharel committed
209
      {:excoveralls, "~> 0.14.0", only: :test},
Thomas Citharel's avatar
Thomas Citharel committed
210
      {:ex_doc, "~> 0.25", only: [:dev, :test], runtime: false},
Thomas Citharel's avatar
Thomas Citharel committed
211
      {:mix_test_watch, "~> 1.0", only: :dev, runtime: false},
Thomas Citharel's avatar
Thomas Citharel committed
212
      {:ex_unit_notifier, "~> 1.0", only: :test},
Thomas Citharel's avatar
Thomas Citharel committed
213
      {:dialyxir, "~> 1.1", only: [:dev], runtime: false},
Thomas Citharel's avatar
Thomas Citharel committed
214
      {:credo, "~> 1.5", only: [:dev, :test], runtime: false},
Thomas Citharel's avatar
Thomas Citharel committed
215
      {:mock, "~> 0.3.4", only: :test},
Thomas Citharel's avatar
Thomas Citharel committed
216
      {:elixir_feed_parser, "~> 2.1.0", only: :test},
Thomas Citharel's avatar
Thomas Citharel committed
217
      {:mox, "~> 1.0", only: :test},
Thomas Citharel's avatar
Thomas Citharel committed
218
      {:junit_formatter, "~> 3.1", only: [:test]},
219
      {:sobelow, "~> 0.8", only: [:dev, :test]},
setop's avatar
setop committed
220
221
      {:doctor, "~> 0.18.0", only: :dev},
      {:haversine, "~> 0.1.0"}
222
    ] ++ oauth_deps()
Thomas Citharel's avatar
Thomas Citharel committed
223
224
225
226
227
228
229
230
231
232
  end

  # Aliases are shortcuts or tasks specific to the current project.
  # For example, to create, migrate and run the seeds file at once:
  #
  #     $ mix ecto.setup
  #
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    [
miffy's avatar
miffy committed
233
234
235
236
237
238
239
240
241
242
      "ecto.setup": [
        "ecto.create",
        "ecto.migrate",
        "run priv/repo/seeds.exs"
      ],
      "ecto.reset": [
        "ecto.drop",
        "ecto.setup"
      ],
      test: [
243
        "ecto.create",
miffy's avatar
miffy committed
244
        "ecto.migrate",
245
        "tz_world.update",
246
        &run_test/1
miffy's avatar
miffy committed
247
      ],
248
249
250
251
252
253
254
      "phx.deps_migrate_serve": [
        "deps.get",
        "ecto.create --quiet",
        "ecto.migrate",
        "cmd cd js && yarn install && cd ../",
        "phx.server"
      ]
Thomas Citharel's avatar
Thomas Citharel committed
255
256
    ]
  end
Thomas Citharel's avatar
Thomas Citharel committed
257

258
  defp run_test(args) do
259
    File.mkdir("test/uploads")
260
261
262
263
    Mix.Task.run("test", args)
    File.rm_rf!("test/uploads")
  end

Thomas Citharel's avatar
Thomas Citharel committed
264
265
266
267
268
269
  defp docs() do
    [
      source_ref: "v#{@version}",
      groups_for_modules: groups_for_modules(),
      nest_modules_by_prefix: [
        Mobilizon,
Thomas Citharel's avatar
Thomas Citharel committed
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
        Mobilizon.Activities,
        Mobilizon.Actors,
        Mobilizon.Admin,
        Mobilizon.Discussions,
        Mobilizon.Events,
        Mobilizon.GraphQL,
        Mobilizon.Medias,
        Mobilizon.Posts,
        Mobilizon.Reports,
        Mobilizon.Resources,
        Mobilizon.Todos,
        Mobilizon.Users,
        Mobilizon.Federation,
        Mobilizon.Federation.ActivityPub,
        Mobilizon.Federation.ActivityPub.Actions,
        Mobilizon.Federation.ActivityPub.Types,
        Mobilizon.Federation.ActivityStream,
        Mobilizon.Federation.ActivityStream.Converter,
        Mobilizon.GraphQL.Resolvers,
289
        Mobilizon.GraphQL.Schema,
Thomas Citharel's avatar
Thomas Citharel committed
290
291
292
293
294
295
296
297
298
299
        Mobilizon.Service,
        Mobilizon.Service.Activity,
        Mobilizon.Service.Export,
        Mobilizon.Service.Geospatial,
        Mobilizon.Service.Metadata,
        Mobilizon.Service.Workers,
        Mobilizon.Web,
        Mobilizon.Web.Email,
        Mobilizon.Web.Plugs,
        Mobilizon.Web.Upload
Thomas Citharel's avatar
Thomas Citharel committed
300
301
302
303
304
305
306
      ]
    ]
  end

  defp groups_for_modules() do
    [
      Models: [
Thomas Citharel's avatar
Thomas Citharel committed
307
308
309
310
311
312
313
314
315
316
317
318
319
320
        ~r/Mobilizon.Actors~r/,
        ~r/Mobilizon.Addresses/,
        ~r/Mobilizon.Admin/,
        ~r/Mobilizon.Events/,
        ~r/Mobilizon.Instances/,
        ~r/Mobilizon.Medias/,
        ~r/Mobilizon.Mention/,
        ~r/Mobilizon.Reports/,
        ~r/Mobilizon.Share/,
        ~r/Mobilizon.Tombstone/,
        ~r/Mobilizon.Users/
      ],
      "GraphQL APIs": [
        ~r/Mobilizon.GraphQL.API/
Thomas Citharel's avatar
Thomas Citharel committed
321
      ],
Thomas Citharel's avatar
Thomas Citharel committed
322
323
      Emails: [
        ~r/Mobilizon.Web.Email/
Thomas Citharel's avatar
Thomas Citharel committed
324
325
      ],
      Web: [
Thomas Citharel's avatar
Thomas Citharel committed
326
        ~r/Mobilizon.Web/
Thomas Citharel's avatar
Thomas Citharel committed
327
328
      ],
      Geospatial: [
Thomas Citharel's avatar
Thomas Citharel committed
329
        ~r/Mobilizon.Service.Geospatial/
Thomas Citharel's avatar
Thomas Citharel committed
330
      ],
rustra's avatar
rustra committed
331
      Localization: [
Thomas Citharel's avatar
Thomas Citharel committed
332
333
        ~r/Mobilizon.Cldr/,
        ~r/Mobilizon.Web.Gettext/
rustra's avatar
rustra committed
334
      ],
Thomas Citharel's avatar
Thomas Citharel committed
335
      GraphQL: [
Thomas Citharel's avatar
Thomas Citharel committed
336
337
        ~r/Mobilizon.Web.GraphQLSocket/,
        ~r/Mobilizon.GraphQL/
Thomas Citharel's avatar
Thomas Citharel committed
338
339
      ],
      ActivityPub: [
Thomas Citharel's avatar
Thomas Citharel committed
340
341
        ~r/Mobilizon.Federation.ActivityPub/,
        ~r/Mobilizon.Federation.ActivityStream/,
rustra's avatar
rustra committed
342
        Mobilizon.Federation.HTTPSignatures.Signature,
343
344
        Mobilizon.Federation.WebFinger,
        Mobilizon.Federation.WebFinger.XmlBuilder,
rustra's avatar
rustra committed
345
346
347
348
349
350
351
352
        Mobilizon.Web.Plugs.Federating,
        Mobilizon.Web.Plugs.HTTPSignatures,
        Mobilizon.Web.Plugs.MappedSignatureToIdentity,
        Mobilizon.Web.ActivityPubController,
        Mobilizon.Web.NodeInfoController,
        Mobilizon.Web.WebFingerController,
        Mobilizon.Web.ActivityPub.ActorView,
        Mobilizon.Web.ActivityPub.ObjectView
Thomas Citharel's avatar
Thomas Citharel committed
353
354
      ],
      Services: [
Thomas Citharel's avatar
Thomas Citharel committed
355
        ~r/Mobilizon.Service/
Thomas Citharel's avatar
Thomas Citharel committed
356
357
358
      ],
      Tools: [
        Mobilizon.Application,
rustra's avatar
rustra committed
359
360
        Mobilizon.Config,
        Mobilizon.Crypto,
Thomas Citharel's avatar
Thomas Citharel committed
361
        Mobilizon.Factory,
rustra's avatar
rustra committed
362
363
364
        Mobilizon.Storage.Ecto,
        Mobilizon.Storage.Page,
        Mobilizon.Storage.Repo
Thomas Citharel's avatar
Thomas Citharel committed
365
366
367
      ]
    ]
  end
Thomas Citharel's avatar
Thomas Citharel committed
368
end