-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
118 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash -e | ||
|
||
GITHUB_PR_LABEL="dependencies" | ||
COMMIT_TITLE="Update 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 | ||
else | ||
echo "Detected changes to dependencies, also reformatting" | ||
rebar3 fmt --write | ||
fi | ||
|
||
git checkout -b "$BRANCH_NAME" | ||
git add . | ||
|
||
git commit -F- <<EOF | ||
$COMMIT_TITLE | ||
Updates from "rebar3 update-deps --replace": | ||
$_update_output | ||
EOF | ||
|
||
git push --set-upstream origin "$BRANCH_NAME" | ||
|
||
if [[ $(check_pr) == "" ]]; then | ||
gh pr create \ | ||
--label "$GITHUB_PR_LABEL" \ | ||
--title "$COMMIT_TITLE" \ | ||
--body-file - <<EOF | ||
This PR updates the dependencies to their latest versions. | ||
The following changes were made from \`rebar3 update-deps --replace\`: | ||
\`\`\` | ||
$_update_output | ||
\`\`\` | ||
EOF | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Check Dependencies | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '38 8 * * *' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
check-deps: | ||
name: Check Dependencies | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
otp_version: ['27.1'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{ matrix.otp_version }} | ||
rebar3-version: '3.22.1' | ||
version-type: 'strict' | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/rebar3 | ||
_build | ||
key: ${{ runner.os }}-erlang-${{ matrix.otp_version }}-${{ hashFiles('**/*rebar.lock') }} | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Check dependencies | ||
run: .github/workflows/check-deps.sh | ||
env: | ||
BRANCH_NAME: update-deps-${{ github.run_id }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,63 @@ | ||
%%-*- mode: erlang -*- | ||
{cover_enabled, true}. | ||
|
||
{erl_opts, [ | ||
debug_info, | ||
fail_on_warning, | ||
{platform_define, "^[0-9]+", namespaced_types}, | ||
{parse_transform, lager_transform} | ||
]}. | ||
|
||
{project_plugins, [ | ||
erlfmt | ||
]}. | ||
{project_plugins, [erlfmt, rebar3_depup]}. | ||
|
||
{deps, [ | ||
{lager, "3.9.2"}, | ||
recon, | ||
folsom, | ||
{dns_erlang, ".*", {git, "https://github.com/dnsimple/dns_erlang.git", {branch, "main"}}}, | ||
iso8601, | ||
{nodefinder, "2.0.0"}, | ||
{opentelemetry_api, "0.6.0"}, | ||
{meck, "0.9.2"} | ||
{nodefinder, "2.0.7"}, | ||
{opentelemetry_api, "1.4.0"}, | ||
{meck, "1.0.0"} | ||
]}. | ||
|
||
{profiles, [{test, [{deps, [proper]}]}]}. | ||
|
||
{project_plugins, [rebar3_format]}. | ||
|
||
{format, [ | ||
{formatter, default_formatter}, | ||
{files, [ | ||
"src/**/*.?rl", "include/**/*.?rl" | ||
]}, | ||
{files, ["src/**/*.?rl", "include/**/*.?rl"]}, | ||
{options, #{ | ||
paper => 160, | ||
ribbon => 150, | ||
inline_attributes => none, | ||
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"}, | ||
{overlay, [ | ||
{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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters