Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONTRIB: Automate AUTHORS file update #10308

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Akshay Venkatesh <akvenkatesh@nvidia.com>
Aleksey Senin <alekseys@nvidia.com>
Alexey Rivkin <arivkin@nvidia.com>
Alex Margolin <alex.margolin@huawei.com>
Alex Mikheev <alexm@mellanox.com>
Alexey Rivkin <arivkin@nvidia.com>
Alina Sklarevich <alinas@mellanox.com>
Anatoly Vildemanov <anatolyv@nvidia.com>
Andrey Maslennikov <andreyma@mellanox.com>
Expand Down
27 changes: 27 additions & 0 deletions buildlib/pr/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,33 @@ jobs:
fi
condition: eq(variables['Build.Reason'], 'PullRequest')

- job: author
displayName: AUTHORS file check
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved
pool:
name: MLNX
demands:
- ucx_docker -equals yes
container: fedora
steps:
- checkout: self
clean: true
fetchDepth: 100
retryCountOnTaskFailure: 5

- bash: |
set -eE
set -x
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved
source ./buildlib/az-helpers.sh
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved

BASE_SOURCEVERSION=$(git rev-parse HEAD^)
range="$BASE_SOURCEVERSION..$(Build.SourceVersion)"

echo "Looking for missing AUTHORS on commit range ${range}"
./contrib/authors_update.sh "$range"
git diff --exit-code
displayName: AUTHORS file check


- job: codespell
displayName: codespell check
pool:
Expand Down
40 changes: 40 additions & 0 deletions contrib/authors_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
#
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# See file LICENSE for terms.
#

set -eu
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved
set -o pipefail
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved

range="${1?Provide commit range like orig/v1.17..orig/v1.18}"
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like -> , for example:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


michal-shalev marked this conversation as resolved.
Show resolved Hide resolved
if [ ! -f AUTHORS ]
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved
then
echo "AUTHORS file not accessible"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not writable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, but -w also covers the case where file does not exist

exit 1
fi

# Failure triggered if range is not valid
git --no-pager log --oneline --pretty=format:"%h %an <%ae> %s" "$range"
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved

tmp=$(mktemp --tmpdir=./)
grep @ AUTHORS >"$tmp"

echo
echo "Names:"

git log --no-merges --pretty=format:"%an%x09%ae" "$range" | sort | uniq | \
michal-shalev marked this conversation as resolved.
Show resolved Hide resolved
while IFS=$'\t' read -r name email; do
line="$name <$email>"
if ! grep -iqw "$email" "$tmp" && ! grep -iq "$name" "$tmp"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you pls add comment what this does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

echo "$line" >>"$tmp"
echo "++ $line"
else
echo " $line"
fi
done

LC_COLLATE=C sort -o "$tmp"{,}
grep -v @ AUTHORS >>"$tmp"
mv "$tmp" AUTHORS
Loading