From 75ba04ef2623647a34c5791770f0d0ddafea67b7 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Mon, 28 Oct 2024 13:08:37 +0100 Subject: [PATCH 1/8] rebar.config --- rebar.config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rebar.config b/rebar.config index 7bffb0e2..f94f4468 100644 --- a/rebar.config +++ b/rebar.config @@ -8,7 +8,8 @@ ]}. {project_plugins, [ - erlfmt + erlfmt, + rebar3_depup ]}. {deps, [ @@ -25,8 +26,6 @@ {profiles, [{test, [{deps, [proper]}]}]}. -{project_plugins, [rebar3_format]}. - {format, [ {formatter, default_formatter}, {files, [ @@ -40,6 +39,8 @@ }} ]}. +{depup, [{only, minor}]}. + {shell, [ {apps, [erldns]}, {config, "erldns.config"} From f1974061c58f1dca141359c23e5f2f5020083700 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Mon, 28 Oct 2024 16:20:18 +0100 Subject: [PATCH 2/8] Check dependencies automatically once a day (#164) --- .github/workflows/check-deps.sh | 39 ++++++++++++++++++++++++++++++ .github/workflows/check_deps.yml | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100755 .github/workflows/check-deps.sh create mode 100644 .github/workflows/check_deps.yml diff --git a/.github/workflows/check-deps.sh b/.github/workflows/check-deps.sh new file mode 100755 index 00000000..52f92d31 --- /dev/null +++ b/.github/workflows/check-deps.sh @@ -0,0 +1,39 @@ +#!/bin/bash -e + +GITHUB_PR_LABEL="dependencies" + +if [ -z "$BRANCH_NAME" ]; then + echo "Branch name is required" + exit 1 +fi + +function check_pr { + gh pr list --state open --label "$GITHUB_PR_LABEL" +} + +git config user.name "${GITHUB_ACTOR}" +git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + +_update_output="$(TERM=dumb rebar3 update-deps --replace)" + +if git diff --exit-code --quiet; then + echo "No changes to the dependencies" + exit 0 +fi + +git checkout -b "$BRANCH_NAME" +git add . + +git commit -F- < Date: Mon, 11 Nov 2024 12:35:06 +0100 Subject: [PATCH 3/8] Actually check dependencies in CI (#168) --- .github/workflows/check-deps.sh | 18 ++++++++++++++++-- .github/workflows/check_deps.yml | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-deps.sh b/.github/workflows/check-deps.sh index 52f92d31..7ac2236f 100755 --- a/.github/workflows/check-deps.sh +++ b/.github/workflows/check-deps.sh @@ -1,6 +1,7 @@ #!/bin/bash -e GITHUB_PR_LABEL="dependencies" +COMMIT_TITLE="Update dependencies" if [ -z "$BRANCH_NAME" ]; then echo "Branch name is required" @@ -19,13 +20,15 @@ _update_output="$(TERM=dumb rebar3 update-deps --replace)" if git diff --exit-code --quiet; then echo "No changes to the dependencies" exit 0 +else + echo "Detected changes to dependencies" fi git checkout -b "$BRANCH_NAME" git add . git commit -F- < Date: Tue, 12 Nov 2024 08:49:15 +0100 Subject: [PATCH 4/8] Fix spec for erldns_zone_parser:zone_to_erlang/1 (#170) --- src/erldns_zone_parser.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/erldns_zone_parser.erl b/src/erldns_zone_parser.erl index 9ae18bb6..5c06fd03 100644 --- a/src/erldns_zone_parser.erl +++ b/src/erldns_zone_parser.erl @@ -59,7 +59,7 @@ start_link() -> %% @doc Takes a JSON zone and turns it into the tuple {Name, Sha, Records}. %% %% The default timeout for parsing is currently 30 seconds. --spec zone_to_erlang(binary()) -> {binary(), binary(), [dns:rr()], [erldns:keyset()]}. +-spec zone_to_erlang(map() | list()) -> {binary(), binary(), [dns:rr()], [erldns:keyset()]}. zone_to_erlang(Zone) -> gen_server:call(?SERVER, {parse_zone, Zone}, ?PARSE_TIMEOUT). From 9f524aee1e42255d9419899dceb22dda6d6f37f5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:11:54 +0100 Subject: [PATCH 5/8] Update dependencies (#169) Updates from "rebar3 update-deps --replace": ===> Looking for dependencies to update in rebar.config... ===> jsx (profile default) can be updated from 3.0.0 to 3.1.0 ===> dns_erlang (profile default) can't be updated because it's not using a tag ===> nodefinder (profile default) can be updated from 2.0.0 to 2.0.7 ===> opentelemetry_api (profile default) can be updated from 0.6.0 to 1.4.0 ===> Dependencies updated in rebar.config. Don't forget to run rebar3 upgrade [-a] [] --- .github/workflows/check-deps.sh | 3 ++- rebar.config | 45 +++++++++------------------------ 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/.github/workflows/check-deps.sh b/.github/workflows/check-deps.sh index 7ac2236f..f7c60212 100755 --- a/.github/workflows/check-deps.sh +++ b/.github/workflows/check-deps.sh @@ -21,7 +21,8 @@ if git diff --exit-code --quiet; then echo "No changes to the dependencies" exit 0 else - echo "Detected changes to dependencies" + echo "Detected changes to dependencies, also reformatting" + rebar3 fmt --write fi git checkout -b "$BRANCH_NAME" diff --git a/rebar.config b/rebar.config index f94f4468..2adab19c 100644 --- a/rebar.config +++ b/rebar.config @@ -1,5 +1,6 @@ %%-*- mode: erlang -*- {cover_enabled, true}. + {erl_opts, [ debug_info, fail_on_warning, @@ -7,30 +8,24 @@ {parse_transform, lager_transform} ]}. -{project_plugins, [ - erlfmt, - rebar3_depup -]}. +{project_plugins, [erlfmt, rebar3_depup]}. {deps, [ {lager, "3.9.2"}, recon, folsom, - {jsx, "3.0.0"}, + {jsx, "3.1.0"}, {dns_erlang, ".*", {git, "https://github.com/dnsimple/dns_erlang.git", {branch, "main"}}}, iso8601, - {nodefinder, "2.0.0"}, - {opentelemetry_api, "0.6.0"}, + {nodefinder, "2.0.7"}, + {opentelemetry_api, "1.4.0"}, {meck, "0.9.2"} ]}. - {profiles, [{test, [{deps, [proper]}]}]}. {format, [ {formatter, default_formatter}, - {files, [ - "src/**/*.?rl", "include/**/*.?rl" - ]}, + {files, ["src/**/*.?rl", "include/**/*.?rl"]}, {options, #{ paper => 160, ribbon => 150, @@ -38,17 +33,12 @@ inline_qualified_function_composition => true }} ]}. - {depup, [{only, minor}]}. -{shell, [ - {apps, [erldns]}, - {config, "erldns.config"} -]}. +{shell, [{apps, [erldns]}, {config, "erldns.config"}]}. {relx, [ {release, {erldns, "3.0.0"}, [erldns]}, - {dev_mode, true}, {include_erts, false}, {sys_config, "erldns.config"}, @@ -56,30 +46,19 @@ {copy, "priv/zones-example.json", "priv/zones-example.json"}, {copy, "priv/zones-test.json", "priv/zones-test.json"} ]}, - {extended_start_script, true} ]}. -%% This is a rebar3-ism {overrides, [ {override, dns_erlang, [ - {plugins, [ - {provider_asn1, "0.2.3"} - ]}, + {plugins, [{provider_asn1, "0.2.3"}]}, {provider_hooks, [ - {pre, [ - {compile, {asn, compile}} - ]}, - {post, [ - {clean, {asn, clean}} - ]} + {pre, [{compile, {asn, compile}}]}, + {post, [{clean, {asn, clean}}]} ]} ]} ]}. - {dialyzer, [{warnings, [no_unknown]}]}. +{erlfmt, [write, {print_width, 140}]}. -{erlfmt, [ - write, - {print_width, 140} -]}. +%% This is a rebar3-ism From e5d6202400670414c941f16d7b5e3b35d3de0217 Mon Sep 17 00:00:00 2001 From: Ivan Bakalov Date: Wed, 18 Dec 2024 12:37:14 +0200 Subject: [PATCH 6/8] build: add zone_to_erlang/2 allowing for custom timeout (#171) --- src/erldns_zone_parser.erl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/erldns_zone_parser.erl b/src/erldns_zone_parser.erl index 5c06fd03..5bab58f8 100644 --- a/src/erldns_zone_parser.erl +++ b/src/erldns_zone_parser.erl @@ -24,6 +24,7 @@ -export([ start_link/0, zone_to_erlang/1, + zone_to_erlang/2, register_parsers/1, register_parser/1, list_parsers/0 @@ -63,6 +64,10 @@ start_link() -> zone_to_erlang(Zone) -> gen_server:call(?SERVER, {parse_zone, Zone}, ?PARSE_TIMEOUT). +-spec zone_to_erlang(binary(), integer()) -> {binary(), binary(), [dns:rr()], [erldns:keyset()]}. +zone_to_erlang(Zone, Timeout) -> + gen_server:call(?SERVER, {parse_zone, Zone}, Timeout). + %% @doc Register a list of custom parser modules. -spec register_parsers([module()]) -> ok. register_parsers(Modules) -> From fb5ab1cec5f0df69e31b436c4580a3e8d06e9795 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Thu, 19 Dec 2024 11:27:07 +0100 Subject: [PATCH 7/8] Add correct permissions to GitHub Actions (#172) --- .github/workflows/check_deps.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check_deps.yml b/.github/workflows/check_deps.yml index e6c20ca0..6caabd24 100644 --- a/.github/workflows/check_deps.yml +++ b/.github/workflows/check_deps.yml @@ -9,6 +9,8 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: write-all + jobs: check-deps: name: Check Dependencies From 324ab10d91b228702ec2d981eefc5bbc804bf184 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:31:51 +0100 Subject: [PATCH 8/8] Update dependencies (#173) Updates from "rebar3 update-deps --replace": ===> Looking for dependencies to update in rebar.config... ===> dns_erlang (profile default) can't be updated because it's not using a tag ===> meck (profile default) can be updated from 0.9.2 to 1.0.0 ===> Some comments could've been lost or misplaced. We moved from 2 to 2 ===> Dependencies updated in rebar.config. Don't forget to run rebar3 upgrade [-a] [] Co-authored-by: whatyouhide --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 2adab19c..f6b174d5 100644 --- a/rebar.config +++ b/rebar.config @@ -19,7 +19,7 @@ iso8601, {nodefinder, "2.0.7"}, {opentelemetry_api, "1.4.0"}, - {meck, "0.9.2"} + {meck, "1.0.0"} ]}. {profiles, [{test, [{deps, [proper]}]}]}.