Skip to content

Commit

Permalink
Update OTP-version running for github actions (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiw authored Dec 23, 2024
1 parent e10eada commit 7459bc5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 44 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ on:

jobs:
test:
runs-on: ubuntu-latest
name: Erlang/OTP 25.1 / rebar3 3.20.0
runs-on: ${{matrix.erlang.os}}
name: Erlang/OTP ${{matrix.erlang.otp}} / rebar3 ${{matrix.erlang.rebar3}}
strategy:
matrix:
erlang:
- otp: "27.1.2"
rebar3: "3.22.1"
os: ubuntu-24.04
env:
OTC_NO_DIA: true
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: '25.1'
rebar3-version: '3.20.0'
otp-version: ${{matrix.erlang.otp}}
rebar3-version: ${{matrix.erlang.rebar3}}
- run: rebar3 eunit
61 changes: 22 additions & 39 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@

COMPILE_ASN1 = false =:= os:getenv("OTC_NO_ASN1"),
COMPILE_DIA = false =:= os:getenv("OTC_NO_DIA"),
NO_ASN1 = false =/= os:getenv("OTC_NO_ASN1"),
NO_DIA = false =/= os:getenv("OTC_NO_DIA"),

io:format("Compile ASN.1-files: ~p~n", [COMPILE_ASN1]),
io:format("Compile Diameter dicts: ~p~n", [COMPILE_DIA]),

Remove_from_provider_hooks =
fun(Key, Config0) ->
case lists:keytake(provider_hooks, 1, Config0) of
{value, {provider_hooks, Hooks0}, Config1} ->
Hooks = [{K, [C || {_, {T, _}} = C <- Hs, Key =/= T]}
|| {K, Hs} <- Hooks0],
[{provider_hooks, Hooks}|Config1];
false ->
Config0
end
end,
io:format("Disable ASN.1: ~p~n", [NO_ASN1]),
io:format("Disable Diameter dicts: ~p~n", [NO_DIA]),

Remove_from_plugins =
fun(Key, Config0) ->
Expand All @@ -28,31 +16,26 @@ Remove_from_plugins =
end
end,

Remove_asn1_config =
fun(Config0) ->
Config1 = Remove_from_plugins(provider_asn1, Config0),
Config2 = Remove_from_provider_hooks(asn, Config1),
Config2
Remove_from_provider_hooks =
fun(Key, Config0) ->
case lists:keytake(provider_hooks, 1, Config0) of
{value, {provider_hooks, Hooks0}, Config1} ->
Hooks = [{K, [C || {_, {T, _}} = C <- Hs, Key =/= T]}
|| {K, Hs} <- Hooks0],
[{provider_hooks, Hooks}|Config1];
false ->
Config0
end
end,

Remove_dia_config =
fun(Config0) ->
Config1 = Remove_from_plugins(rebar3_diameter_compiler, Config0),
Config1
Remove_from_config =
fun ({Plugin, HookName}, Config0) ->
Config1 = Remove_from_plugins(Plugin, Config0),
Config2 = Remove_from_provider_hooks(HookName, Config1),
Config2
end,

C0 = case COMPILE_ASN1 of
true ->
CONFIG;
_ ->
Remove_asn1_config(CONFIG)
end,

C1 = case COMPILE_DIA of
true ->
C0;
_ ->
Remove_dia_config(C0)
end,
DisabledPlugins = [{provider_asn1, asn} || NO_ASN1]
++ [{rebar3_diameter_compiler, diameter} || NO_DIA],

C1.
lists:foldl(Remove_from_config, CONFIG, DisabledPlugins).

0 comments on commit 7459bc5

Please sign in to comment.