-
Notifications
You must be signed in to change notification settings - Fork 16
/
mix.exs
184 lines (158 loc) · 5.04 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
defmodule Fishjam.MixProject do
use Mix.Project
def project do
[
app: :fishjam,
version: "0.6.3",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
dialyzer: dialyzer(),
# TODO: Remove once core fix bug
consolidate_protocols: false,
# hex
description: "Fishjam media server",
# test coverage
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.json": :test
]
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {Fishjam.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(env) when env in [:test, :test_cluster], do: ["lib", "test/support"]
defp elixirc_paths(_env), do: ["lib"]
defp deps do
[
{:phoenix, "~> 1.7.1"},
{:phoenix_live_dashboard, "~> 0.7.2"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_metrics_prometheus, "~> 1.1"},
{:telemetry_poller, "~> 1.0"},
{:jason, "~> 1.2"},
{:plug_cowboy, "~> 2.5"},
{:elixir_uuid, "~> 1.2"},
{:cors_plug, "~> 3.0"},
{:open_api_spex, "~> 3.19"},
{:ymlr, "~> 3.0"},
{:bunch, "~> 1.6"},
{:logger_json, "~> 5.1"},
# aws deps
{:ex_aws, "~> 2.1"},
{:ex_aws_s3, "~> 2.0"},
{:sweet_xml, "~> 0.6"},
# protobuf deps
{:protobuf, "~> 0.12.0"},
# Membrane deps
{:membrane_core, "~> 1.1.0-rc1", override: true},
{:membrane_rtc_engine,
github: "fishjam-dev/membrane_rtc_engine",
sparse: "engine",
ref: "dc3ffd0051dd3aec6de142076ac01a5f79fe846a",
override: "true"},
{:membrane_rtc_engine_webrtc,
github: "fishjam-dev/membrane_rtc_engine",
sparse: "webrtc",
ref: "dc3ffd0051dd3aec6de142076ac01a5f79fe846a",
override: "true"},
{:membrane_rtc_engine_hls, "~> 0.7.0"},
{:membrane_rtc_engine_recording,
github: "fishjam-dev/membrane_rtc_engine",
sparse: "recording",
ref: "dc3ffd0051dd3aec6de142076ac01a5f79fe846a",
override: "true"},
{:membrane_rtc_engine_rtsp,
github: "fishjam-dev/membrane_rtc_engine",
sparse: "rtsp",
ref: "dc3ffd0051dd3aec6de142076ac01a5f79fe846a",
override: "true"},
{:membrane_rtc_engine_file, "~> 0.5.0"},
{:membrane_rtc_engine_sip,
github: "fishjam-dev/membrane_rtc_engine",
sparse: "sip",
ref: "dc3ffd0051dd3aec6de142076ac01a5f79fe846a",
override: "true"},
{:membrane_telemetry_metrics, "~> 0.1.0"},
# HLS endpoints deps
{:membrane_audio_mix_plugin, "~> 0.16.0"},
{:membrane_video_compositor_plugin, "~> 0.7.0"},
# Dialyzer and credo
{:dialyxir, ">= 0.0.0", only: :dev, runtime: false},
{:credo, ">= 0.0.0", only: :dev, runtime: false},
# Load balancing
{:libcluster, "~> 3.3"},
{:httpoison, "~> 2.0"},
# Mocking timer in tests
{:klotho, "~> 0.1.0"},
# Test deps
{:websockex, "~> 0.4.3", only: [:test, :test_cluster], runtime: false},
{:excoveralls, "~> 0.15.0", only: :test, runtime: false},
{:mox, "~> 1.0", only: [:test, :test_cluster]}
]
end
defp aliases do
[
setup: ["deps.get"],
"api.spec": &generate_api_spec/1,
test: ["test --exclude cluster"],
"test.cluster.epmd": [
"cmd docker compose -f docker-compose-epmd.yaml up test; docker compose -f docker-compose-epmd.yaml down"
],
"test.cluster.dns": [
"cmd docker compose -f docker-compose-dns.yaml up test; docker compose -f docker-compose-dns.yaml down"
]
]
end
defp dialyzer() do
opts = [
flags: [:error_handling]
]
if System.get_env("CI") == "true" do
# Store PLTs in cacheable directory for CI
[plt_local_path: "priv/plts", plt_core_path: "priv/plts"] ++ opts
else
opts
end
end
defp generate_api_spec(_args) do
output_filename = "openapi.yaml"
generated_filename = "openapi-gen.yaml"
Mix.shell().info("Generating #{output_filename}...")
{_io_stream, exit_status} =
System.cmd(
"mix",
[
"openapi.spec.yaml",
"--start-app=false",
"--spec",
"FishjamWeb.ApiSpec",
generated_filename
],
into: IO.stream()
)
if exit_status != 0, do: raise("Failed to generate OpenAPI spec")
File.write!(output_filename, """
# This file has been generated using OpenApiSpex. Do not edit manually!
# Run `mix api.spec` to regenerate
""")
File.read!(generated_filename)
|> then(&File.write!(output_filename, &1, [:append]))
File.rm!(generated_filename)
Mix.shell().info("Successfully generated #{output_filename}")
end
end