Skip to content

Commit 55e7471

Browse files
committed
Update CI and mix format
1 parent 1b74ed4 commit 55e7471

6 files changed

Lines changed: 1407 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
elixir: "1.19.5-otp-27"
3939
- otp: "28.3.1"
4040
elixir: "1.19.5-otp-28"
41-
- otp: "28.3.1"
42-
elixir: "1.20.0-rc.1-otp-28"
41+
- otp: "29.0"
42+
elixir: "1.20.0-rc.5-otp-29"
4343
lint: true
4444
steps:
4545
# Step: Setup Elixir + Erlang image as the base.
@@ -86,20 +86,24 @@ jobs:
8686
run: mix deps.get
8787

8888
# Step: Compile the project treating any warnings as errors.
89-
# Customize this step if a different behavior is desired.
9089
- name: Compiles without warnings
9190
run: mix compile --warnings-as-errors
9291

93-
# Step: Check that the checked in code has already been formatted.
94-
# This step fails if something was found unformatted.
95-
# Customize this step as desired.
96-
# - name: Check Formatting
97-
# run: mix format --check-formatted
92+
# Step: Check that the checked-in code has already been formatted.
93+
# Only runs on the canonical (lint) matrix entry — formatting
94+
# rules can shift between Elixir minor versions and we only
95+
# enforce the latest.
96+
- name: Check formatting
97+
if: ${{ matrix.lint }}
98+
run: mix format --check-formatted
9899

99100
# Step: Execute the tests.
100101
- name: Run tests
101102
run: mix test
102103

103-
# Step: Execute dialyzer.
104+
# Step: Execute dialyzer. Only on the lint matrix entry —
105+
# dialyzer output varies across OTP versions and we pin
106+
# the canonical check to one row.
104107
- name: Run dialyzer
108+
if: ${{ matrix.lint }}
105109
run: mix dialyzer

lib/money.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ defmodule Money do
8383
def known_currencies do
8484
Localize.Currency.known_currency_codes() ++ Money.Currency.Store.codes()
8585
end
86+
8687
defdelegate known_current_currencies, to: Money.Currency
8788
defdelegate known_historic_currencies, to: Money.Currency
8889
defdelegate known_tender_currencies, to: Money.Currency

lib/money/currency.ex

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,11 @@ defmodule Money.Currency do
258258

259259
{:error, _} ->
260260
case Money.Currency.Store.get(normalize_code(code)) do
261-
nil -> {:error, {Money.UnknownCurrencyError, "The currency #{inspect(code)} is not known."}}
262-
currency -> {:ok, currency}
261+
nil ->
262+
{:error, {Money.UnknownCurrencyError, "The currency #{inspect(code)} is not known."}}
263+
264+
currency ->
265+
{:ok, currency}
263266
end
264267
end
265268
end
@@ -293,7 +296,10 @@ defmodule Money.Currency do
293296
Regex.match?(@valid_private_currency_code, upcase_code) do
294297
{:ok, String.to_atom(upcase_code)}
295298
else
296-
{:error, Money.UnknownCurrencyError.exception("The currency #{inspect(currency_code)} is not a valid custom currency code.")}
299+
{:error,
300+
Money.UnknownCurrencyError.exception(
301+
"The currency #{inspect(currency_code)} is not a valid custom currency code."
302+
)}
297303
end
298304
end
299305

0 commit comments

Comments
 (0)