From 7459bc5a5f507045e002b7d969ecf8f954d3ad49 Mon Sep 17 00:00:00 2001 From: Sebastian Weddmark Olsson Date: Mon, 23 Dec 2024 13:31:48 +0100 Subject: [PATCH] Update OTP-version running for github actions (#36) --- .github/workflows/test.yaml | 18 ++++++++--- rebar.config.script | 61 +++++++++++++------------------------ 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2ddccee..37a8d8e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 diff --git a/rebar.config.script b/rebar.config.script index d31ab52..68f7b13 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -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) -> @@ -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).