Skip to content

Commit

Permalink
Update to Elixir 1.15 + OTP 26
Browse files Browse the repository at this point in the history
  • Loading branch information
doughsay committed Jul 22, 2023
1 parent b26d4f2 commit 8c0078c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
env:
MIX_ENV: test
# NOTE: make sure these versions match in Containerfile and .tool-versions
ELIXIR_VERSION_SPEC: "1.14.5"
OTP_VERSION_SPEC: "25.3.2.2"
ELIXIR_VERSION_SPEC: "1.15.4"
OTP_VERSION_SPEC: "26.0.2"

jobs:
compile:
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NOTE: make sure these versions match in Containerfile and .github/workflows/elixir.yml

elixir 1.14.5-otp-25
erlang 25.3.2.2
elixir 1.15.4-otp-26
erlang 26.0.2
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# NOTE: make sure these versions match in .github/workflows/elixir.yml and .tool-versions
# NOTE: make sure the alpine version matches down below
FROM docker.io/hexpm/elixir:1.14.5-erlang-25.3.2.2-alpine-3.18.2 AS elixir-builder
FROM docker.io/hexpm/elixir:1.15.4-erlang-26.0.2-alpine-3.18.2 AS elixir-builder

ARG MIX_ENV=prod

Expand Down
10 changes: 6 additions & 4 deletions lib/ambry/media/audit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Ambry.Media.Audit do
case File.ls(media.source_path) do
{:ok, relative_paths} ->
relative_paths
|> NaturalSort.sort()
|> Enum.sort(NaturalOrder)
|> Enum.flat_map(fn path ->
file_stat(Path.join([media.source_path, path]))
end)
Expand All @@ -52,7 +52,7 @@ defmodule Ambry.Media.Audit do
case File.ls(path) do
{:ok, relative_paths} ->
relative_paths
|> NaturalSort.sort()
|> Enum.sort(NaturalOrder)
|> Enum.flat_map(fn p ->
file_stat(Path.join([path, p]))
end)
Expand Down Expand Up @@ -93,14 +93,15 @@ defmodule Ambry.Media.Audit do
existing_files = Paths.media_disk_path() |> File.ls!() |> MapSet.new()

query =
from m in Media,
from(m in Media,
select: %{
id: m.id,
source_folder: fragment("regexp_replace(source_path, '^.*/', '')"),
mpd_file: fragment("regexp_replace(mpd_path, '^.*/', '')"),
hls_file: fragment("regexp_replace(hls_path, '^.*/', '')"),
mp4_file: fragment("regexp_replace(mp4_path, '^.*/', '')")
}
)

media = Repo.all(query)

Expand Down Expand Up @@ -183,9 +184,10 @@ defmodule Ambry.Media.Audit do
broken_media_ids = Enum.map(broken_media, & &1.id)

query =
from m in Media,
from(m in Media,
preload: [:book, media_narrators: [:narrator]],
where: m.id in ^broken_media_ids
)

broken_media_structs_by_id = query |> Repo.all() |> Map.new(&{&1.id, &1})

Expand Down
2 changes: 1 addition & 1 deletion lib/ambry/media/processor/shared.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule Ambry.Media.Processor.Shared do
def filter_filenames(filenames, extensions) do
filenames
|> Enum.filter(&(Path.extname(&1) in extensions))
|> NaturalSort.sort()
|> Enum.sort(NaturalOrder)
end

def create_concat_text_file!(media, extensions) do
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ defmodule Ambry.MixProject do
{:hashids, "~> 2.0"},
{:jason, "~> 1.2"},
{:lexical_credo, "~> 0.1", only: [:dev, :test]},
{:natural_sort, "~> 0.3"},
{:natural_order, "~> 0.3"},
{:npm_deps, "~> 0.3.1", runtime: false},
{:oban, "~> 2.11"},
{:phoenix_ecto, "~> 4.4"},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"mint": {:hex, :mint, "1.5.1", "8db5239e56738552d85af398798c80648db0e90f343c8469f6c6d8898944fb6f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4a63e1e76a7c3956abd2c72f370a0d0aecddc3976dea5c27eccbecfa5e7d5b1e"},
"natural_sort": {:hex, :natural_sort, "0.3.0", "4fcfbec40a4f59f91554f47db544e83d433ab489bf8c609ed630adf226ebcd6c", [:mix], [], "hexpm", "6c3476edf395c487a8b55d104458e0f029ca2adb7a0373d12a7a08643f7e7172"},
"natural_order": {:hex, :natural_order, "0.3.0", "a0e3e7aeb8daa50f0463ce6967e94d47ab227a02cca0e1d03b8828b2d480c74b", [:mix], [], "hexpm", "0f0a0f65bb8e313d0e60e37862e9357038386fa48febf8f96ab36375f678afd8"},
"nimble_options": {:hex, :nimble_options, "1.0.2", "92098a74df0072ff37d0c12ace58574d26880e522c22801437151a159392270e", [:mix], [], "hexpm", "fd12a8db2021036ce12a309f26f564ec367373265b53e25403f0ee697380f1b8"},
"nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"},
"nimble_pool": {:hex, :nimble_pool, "1.0.0", "5eb82705d138f4dd4423f69ceb19ac667b3b492ae570c9f5c900bb3d2f50a847", [:mix], [], "hexpm", "80be3b882d2d351882256087078e1b1952a28bf98d0a287be87e4a24a710b67a"},
Expand Down
11 changes: 6 additions & 5 deletions test/ambry/media/audit_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ defmodule Ambry.Media.AuditTest do

describe "get_media_file_details/1" do
test "returns source file details" do
%{source_path: source_path} = media = insert(:media, mpd_path: nil, mp4_path: nil, hls_path: nil)
%{source_path: source_path} =
media = insert(:media, mpd_path: nil, mp4_path: nil, hls_path: nil)

create_fake_source_files!(source_path)

Expand All @@ -14,19 +15,19 @@ defmodule Ambry.Media.AuditTest do
assert %{
source_files: [
%{
path: bar_mp3_path,
path: out_files_txt_path,
stat: %File.Stat{}
},
%{
path: baz_mp3_path,
path: bar_mp3_path,
stat: %File.Stat{}
},
%{
path: foo_mp3_path,
path: baz_mp3_path,
stat: %File.Stat{}
},
%{
path: out_files_txt_path,
path: foo_mp3_path,
stat: %File.Stat{}
}
]
Expand Down

0 comments on commit 8c0078c

Please sign in to comment.