Skip to content

Commit 260b53f

Browse files
authored
Add OTP 26 to CI (#12564)
1 parent 04d2592 commit 260b53f

File tree

2 files changed

+33
-29
lines changed

2 files changed

+33
-29
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
include:
27-
- otp_version: 25.0
27+
- otp_version: '26.0'
2828
otp_latest: true
29-
- otp_version: 24.3
30-
- otp_version: 24.0
29+
- otp_version: '25.3'
30+
- otp_version: '25.0'
31+
- otp_version: '24.3'
32+
- otp_version: '24.0'
3133
- otp_version: master
3234
development: true
3335
- otp_version: maint
@@ -48,9 +50,6 @@ jobs:
4850
run: bin/elixir --version
4951
- name: Check format
5052
run: make test_formatted && echo "All Elixir source code files are properly formatted."
51-
- name: Run Dialyzer
52-
run: dialyzer -pa lib/elixir/ebin --build_plt --output_plt elixir.plt --apps lib/elixir/ebin/elixir.beam lib/elixir/ebin/Elixir.Kernel.beam
53-
continue-on-error: ${{ matrix.development }}
5453
- name: Erlang test suite
5554
run: make test_erlang
5655
continue-on-error: ${{ matrix.development }}
@@ -78,7 +77,7 @@ jobs:
7877
name: Windows Server 2019, Erlang/OTP ${{ matrix.otp_version }}
7978
strategy:
8079
matrix:
81-
otp_version: ['24', '25']
80+
otp_version: ['24', '25', '26']
8281
runs-on: windows-2019
8382
steps:
8483
- name: Configure Git

lib/elixir/src/elixir.erl

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,20 @@
2424
-type struct() :: #{'__struct__' := atom(), atom() => any()}.
2525

2626
%% OTP Application API
27+
%% TODO: Remove Erlang/OTP 26+ checks
2728

28-
-if(?OTP_RELEASE >= 26).
29-
load_paths(Paths) -> code:add_pathsa(Paths, cache).
30-
-else.
31-
load_paths(Paths) -> code:add_pathsa(Paths).
32-
-endif.
29+
load_paths(OTP, Paths) when OTP >= 26 -> code:add_pathsa(Paths, cache);
30+
load_paths(_OTP, Paths) -> code:add_pathsa(Paths).
3331

3432
start(_Type, _Args) ->
35-
_ = parse_otp_release(),
33+
OTP = parse_otp_release(),
3634
preload_common_modules(),
37-
set_stdio_and_stderr_to_binary_and_maybe_utf8(),
35+
set_stdio_and_stderr_to_binary_and_maybe_utf8(OTP),
3836
check_file_encoding(file:native_name_encoding()),
3937

4038
case init:get_argument(elixir_root) of
4139
{ok, [[Root]]} ->
42-
load_paths([
40+
load_paths(OTP, [
4341
Root ++ "/eex/ebin",
4442
Root ++ "/ex_unit/ebin",
4543
Root ++ "/iex/ebin",
@@ -117,9 +115,16 @@ stop(Tab) ->
117115
config_change(_Changed, _New, _Remove) ->
118116
ok.
119117

120-
set_stdio_and_stderr_to_binary_and_maybe_utf8() ->
121-
%% TODO: Remove me once we require Erlang/OTP 26+
122-
ok = io:setopts(standard_io, [binary, {encoding, utf8}]),
118+
set_stdio_and_stderr_to_binary_and_maybe_utf8(OTP) when OTP >= 26 ->
119+
ok = io:setopts(standard_io, [binary]),
120+
ok;
121+
set_stdio_and_stderr_to_binary_and_maybe_utf8(_OTP) ->
122+
Opts =
123+
case init:get_argument(noshell) of
124+
{ok, _} -> [binary, {encoding, utf8}];
125+
error -> [binary]
126+
end,
127+
ok = io:setopts(standard_io, Opts),
123128
ok = io:setopts(standard_error, [{encoding, utf8}]),
124129
ok.
125130

@@ -349,27 +354,27 @@ eval_external_handler(Env) ->
349354
Fun = fun(Ann, FunOrModFun, Args) ->
350355
try
351356
case FunOrModFun of
352-
{Mod, Fun} -> apply(Mod, Fun, Args);
353-
Fun -> apply(Fun, Args)
357+
{Mod, Fun} -> apply(Mod, Fun, Args);
358+
Fun -> apply(Fun, Args)
354359
end
355360
catch
356361
Kind:Reason:Stacktrace ->
357362
%% Take everything up to the Elixir module
358363
Pruned =
359-
lists:takewhile(fun
360-
({elixir,_,_,_}) -> false;
361-
(_) -> true
362-
end, Stacktrace),
364+
lists:takewhile(fun
365+
({elixir,_,_,_}) -> false;
366+
(_) -> true
367+
end, Stacktrace),
363368

364369
Caller =
365-
lists:dropwhile(fun
366-
({elixir,_,_,_}) -> false;
367-
(_) -> true
368-
end, Stacktrace),
370+
lists:dropwhile(fun
371+
({elixir,_,_,_}) -> false;
372+
(_) -> true
373+
end, Stacktrace),
369374

370375
%% Now we prune any shared code path from erl_eval
371376
{current_stacktrace, Current} =
372-
erlang:process_info(self(), current_stacktrace),
377+
erlang:process_info(self(), current_stacktrace),
373378

374379
%% We need to make sure that we don't generate more
375380
%% frames than supported. So we do our best to drop

0 commit comments

Comments
 (0)