Skip to content

Commit 88cec8f

Browse files
authored
Bump CI to Elixir 1.20 and OTP 29 (#434)
1 parent 3cf0065 commit 88cec8f

8 files changed

Lines changed: 53 additions & 33 deletions

File tree

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
include:
20-
- os: ubuntu-22.04
21-
erlang: "27.2"
22-
elixir: "1.18"
20+
- os: ubuntu-24.04
21+
erlang: "29.0"
22+
elixir: "1.20"
2323
lint: true
2424
coverage: true
2525

.github/workflows/publish-to-hex.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
- name: Install Erlang and Elixir
2222
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0
2323
with:
24-
otp-version: "27.2"
25-
elixir-version: "1.18"
24+
otp-version: "29.0"
25+
elixir-version: "1.20"
2626

2727
- name: Fetch dependencies
2828
run: mix deps.get

mix.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
%{
2-
"castore": {:hex, :castore, "1.0.10", "43bbeeac820f16c89f79721af1b3e092399b3a1ecc8df1a472738fd853574911", [:mix], [], "hexpm", "1b0b7ea14d889d9ea21202c43a4fa015eb913021cb535e8ed91946f4b77a8848"},
2+
"castore": {:hex, :castore, "1.0.19", "6903cabdfd9d1af46454126e7c8385186659dd33ecfb74a885cae52221ad6109", [:mix], [], "hexpm", "3669e6cab13f54c2df26b3e6833745d647f35b6e30d8ddd5975df0d5c842ca98"},
33
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
44
"ex_doc": {:hex, :ex_doc, "0.40.3", "4a972ffe64bc07dc605af487e98fc19b72a4185f55ca031b94c0552d6071c1d9", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "2756e357742fecd9749b489b85d67c9ce99c465f2e75728d9e6dc8d704b973de"},
5-
"excoveralls": {:hex, :excoveralls, "0.18.3", "bca47a24d69a3179951f51f1db6d3ed63bca9017f476fe520eb78602d45f7756", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "746f404fcd09d5029f1b211739afb8fb8575d775b21f6a3908e7ce3e640724c6"},
5+
"excoveralls": {:hex, :excoveralls, "0.18.5", "e229d0a65982613332ec30f07940038fe451a2e5b29bce2a5022165f0c9b157e", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "523fe8a15603f86d64852aab2abe8ddbd78e68579c8525ae765facc5eae01562"},
66
"expo": {:hex, :expo, "1.1.1", "4202e1d2ca6e2b3b63e02f69cfe0a404f77702b041d02b58597c00992b601db5", [:mix], [], "hexpm", "5fb308b9cb359ae200b7e23d37c76978673aa1b06e2b3075d814ce12c5811640"},
7-
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
7+
"jason": {:hex, :jason, "1.4.5", "2e3a008590b0b8d7388c20293e9dcc9cf3e5d642fd2a114e4cbbb52e595d940a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b0c823996102bcd0239b3c2444eb00409b72f6a140c1950bc8b457d836b30684"},
88
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
99
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
1010
"makeup_erlang": {:hex, :makeup_erlang, "1.1.0", "835f7e60792e08824cda445639555d7bf1bbbddb1b60b306e33cb6f6db24dc74", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "1cd6780fb1dd1a03979abaed0fe82712b0625118fd5257d3ebbf73f960c73c3c"},

test/gettext/extractor_test.exs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,16 @@ defmodule Gettext.ExtractorTest do
461461
end
462462
"""
463463

464+
# No trailing newline in the expected string below: the logged message ends
465+
# without one, so when color is enabled the reset code (\e[0m) sits between
466+
# the message and Logger's newline. Anchoring on "\n" would fail in a TTY.
464467
assert capture_log(fn ->
465468
Code.compile_string(code, Path.join(File.cwd!(), "foo.ex"))
466469
end) =~
467470
"""
468471
Plural message for 'one error' is not matching:
469472
Using 'multiple errors' instead of '%{count} errors'.
470-
References: foo.ex:9, foo.ex:10
473+
References: foo.ex:9, foo.ex:10\
471474
"""
472475
after
473476
Extractor.disable()

test/gettext/interpolation/default_test.exs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,12 @@ defmodule Gettext.Interpolation.DefaultTest do
107107
)
108108
end
109109

110+
# Building the empty bindings via `Map.drop/2` (rather than a `%{}`
111+
# literal) keeps the compiler's type checker from inferring that
112+
# `translate` only accepts maps with a `:count` key, which would flag
113+
# this intentional missing-key case.
110114
assert_raise MatchError, fn ->
111-
translate.(%{})
115+
translate.(Map.drop(%{count: 7}, [:count]))
112116
end
113117

114118
assert {:ok, "7 shoes"} = translate.(%{count: 7})

test/gettext/merger_test.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ defmodule Gettext.MergerTest do
6767
%Message.Singular{msgid: "obs_auto", obsolete: true},
6868
%Message.Singular{msgid: "obs_manual", obsolete: true}
6969
]
70-
},
71-
stats} =
70+
}, stats} =
7271
Merger.merge(
7372
old_po,
7473
new_pot,

test/mix/tasks/gettext.extract_test.exs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ defmodule Mix.Tasks.Gettext.ExtractTest do
1414

1515
test "extracting and extracting with --merge", %{test: test, tmp_dir: tmp_dir} = context do
1616
create_test_mix_file(context)
17+
mod = unique_module(test)
1718

1819
write_file(context, "lib/my_app.ex", """
19-
defmodule MyApp.Gettext do
20+
defmodule #{mod}.Gettext do
2021
use Gettext.Backend, otp_app: #{inspect(test)}
2122
end
2223
23-
defmodule MyApp do
24-
use Gettext, backend: MyApp.Gettext
24+
defmodule #{mod} do
25+
use Gettext, backend: #{mod}.Gettext
2526
def foo(), do: gettext("hello")
2627
end
2728
""")
@@ -43,8 +44,8 @@ defmodule Mix.Tasks.Gettext.ExtractTest do
4344
# Test --merge too.
4445

4546
write_file(context, "lib/other.ex", """
46-
defmodule MyApp.Other do
47-
use Gettext, backend: MyApp.Gettext
47+
defmodule #{mod}.Other do
48+
use Gettext, backend: #{mod}.Gettext
4849
def foo(), do: dgettext("my_domain", "other")
4950
end
5051
""")
@@ -70,21 +71,22 @@ defmodule Mix.Tasks.Gettext.ExtractTest do
7071
test "--check-up-to-date should fail if no POT files have been created",
7172
%{test: test, tmp_dir: tmp_dir} = context do
7273
create_test_mix_file(context)
74+
mod = unique_module(test)
7375

7476
write_file(context, "lib/my_app.ex", """
75-
defmodule MyApp.Gettext do
77+
defmodule #{mod}.Gettext do
7678
use Gettext.Backend, otp_app: #{inspect(test)}
7779
end
7880
79-
defmodule MyApp do
80-
use Gettext, backend: MyApp.Gettext
81+
defmodule #{mod} do
82+
use Gettext, backend: #{mod}.Gettext
8183
def foo(), do: gettext("hello")
8284
end
8385
""")
8486

8587
write_file(context, "lib/other.ex", """
86-
defmodule MyApp.Other do
87-
use Gettext, backend: MyApp.Gettext
88+
defmodule #{mod}.Other do
89+
use Gettext, backend: #{mod}.Gettext
8890
def foo(), do: dgettext("my_domain", "other")
8991
end
9092
""")
@@ -109,14 +111,15 @@ defmodule Mix.Tasks.Gettext.ExtractTest do
109111
test "--check-up-to-date should pass if nothing changed",
110112
%{test: test, tmp_dir: tmp_dir} = context do
111113
create_test_mix_file(context, write_reference_comments: false)
114+
mod = unique_module(test)
112115

113116
write_file(context, "lib/my_app.ex", """
114-
defmodule MyApp.Gettext do
117+
defmodule #{mod}.Gettext do
115118
use Gettext.Backend, otp_app: #{inspect(test)}
116119
end
117120
118-
defmodule MyApp do
119-
use Gettext, backend: MyApp.Gettext
121+
defmodule #{mod} do
122+
use Gettext, backend: #{mod}.Gettext
120123
def foo(), do: gettext("hello")
121124
end
122125
""")
@@ -135,21 +138,22 @@ defmodule Mix.Tasks.Gettext.ExtractTest do
135138
test "--check-up-to-date should fail if POT files are outdated",
136139
%{test: test, tmp_dir: tmp_dir} = context do
137140
create_test_mix_file(context)
141+
mod = unique_module(test)
138142

139143
write_file(context, "lib/my_app.ex", """
140-
defmodule MyApp.Gettext do
144+
defmodule #{mod}.Gettext do
141145
use Gettext.Backend, otp_app: #{inspect(test)}
142146
end
143147
144-
defmodule MyApp do
145-
use Gettext, backend: MyApp.Gettext
148+
defmodule #{mod} do
149+
use Gettext, backend: #{mod}.Gettext
146150
def foo(), do: gettext("hello")
147151
end
148152
""")
149153

150154
write_file(context, "lib/other.ex", """
151-
defmodule MyApp.Other do
152-
use Gettext, backend: MyApp.Gettext
155+
defmodule #{mod}.Other do
156+
use Gettext, backend: #{mod}.Gettext
153157
def foo(), do: dgettext("my_domain", "other")
154158
end
155159
""")
@@ -159,12 +163,12 @@ defmodule Mix.Tasks.Gettext.ExtractTest do
159163
end)
160164

161165
write_file(context, "lib/my_app.ex", """
162-
defmodule MyApp.Gettext do
166+
defmodule #{mod}.Gettext do
163167
use Gettext.Backend, otp_app: #{inspect(test)}
164168
end
165169
166-
defmodule MyApp do
167-
use Gettext, backend: MyApp.Gettext
170+
defmodule #{mod} do
171+
use Gettext, backend: #{mod}.Gettext
168172
def foo(), do: gettext("hello world")
169173
end
170174
""")

test/support/mix_project_helpers.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
defmodule GettextTest.MixProjectHelpers do
2+
# Returns a module name segment that is unique per test. Tests in this suite
3+
# run in the same VM and reuse fixture module names; because
4+
# `Mix.Project.in_project/4` is called with `prune_code_paths: false`, every
5+
# test's compiled fixtures stay in the code path. Reusing a module name across
6+
# tests would let an earlier test's stale beam shadow the freshly compiled one,
7+
# so we derive a unique base module name from the test name instead.
8+
def unique_module(test) do
9+
"MyApp" <> Integer.to_string(:erlang.phash2(test))
10+
end
11+
212
def create_test_mix_file(context, gettext_config \\ []) do
313
write_file(context, "mix.exs", """
414
defmodule MyApp.MixProject do

0 commit comments

Comments
 (0)