mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Update CI configs to v0.8.1
Update lint scripts and CI configs.
This commit is contained in:
+10
-13
@@ -12,10 +12,10 @@
|
||||
set -e
|
||||
|
||||
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||
AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt"
|
||||
GIT_WORKDIR=${GITHUB_WORKSPACE:-$(git rev-parse --show-toplevel)}
|
||||
AUTHORS_PATH="${GIT_WORKDIR}/AUTHORS.txt"
|
||||
|
||||
if [ -f ${SCRIPT_PATH}/.ci.conf ]
|
||||
then
|
||||
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
|
||||
. ${SCRIPT_PATH}/.ci.conf
|
||||
fi
|
||||
|
||||
@@ -31,8 +31,7 @@ EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion B
|
||||
CONTRIBUTORS=()
|
||||
|
||||
shouldBeIncluded () {
|
||||
for i in "${EXCLUDED_CONTRIBUTORS[@]}"
|
||||
do
|
||||
for i in "${EXCLUDED_CONTRIBUTORS[@]}"; do
|
||||
if [[ $1 =~ "$i" ]]; then
|
||||
return 1
|
||||
fi
|
||||
@@ -42,25 +41,23 @@ shouldBeIncluded () {
|
||||
|
||||
|
||||
IFS=$'\n' #Only split on newline
|
||||
for contributor in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf)
|
||||
do
|
||||
if shouldBeIncluded $contributor; then
|
||||
CONTRIBUTORS+=("$contributor")
|
||||
for CONTRIBUTOR in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf); do
|
||||
if shouldBeIncluded ${CONTRIBUTOR}; then
|
||||
CONTRIBUTORS+=("${CONTRIBUTOR}")
|
||||
fi
|
||||
done
|
||||
unset IFS
|
||||
|
||||
if [ ${#CONTRIBUTORS[@]} -ne 0 ]; then
|
||||
cat >$AUTHORS_PATH <<-'EOH'
|
||||
cat >${AUTHORS_PATH} <<-'EOH'
|
||||
# Thank you to everyone that made Pion possible. If you are interested in contributing
|
||||
# we would love to have you https://github.com/pion/webrtc/wiki/Contributing
|
||||
#
|
||||
# This file is auto generated, using git to list all individuals contributors.
|
||||
# see `.github/generate-authors.sh` for the scripting
|
||||
EOH
|
||||
for i in "${CONTRIBUTORS[@]}"
|
||||
do
|
||||
echo "$i" >> $AUTHORS_PATH
|
||||
for i in "${CONTRIBUTORS[@]}"; do
|
||||
echo "$i" >> ${AUTHORS_PATH}
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
|
||||
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||
|
||||
cp "$SCRIPT_PATH/hooks/commit-msg.sh" "$SCRIPT_PATH/../.git/hooks/commit-msg"
|
||||
cp "$SCRIPT_PATH/hooks/pre-commit.sh" "$SCRIPT_PATH/../.git/hooks/pre-commit"
|
||||
cp "$SCRIPT_PATH/hooks/pre-push.sh" "$SCRIPT_PATH/../.git/hooks/pre-push"
|
||||
cp "${SCRIPT_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg"
|
||||
cp "${SCRIPT_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit"
|
||||
cp "${SCRIPT_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push"
|
||||
|
||||
@@ -58,7 +58,7 @@ if [ "$#" -eq 1 ]; then
|
||||
fi
|
||||
lint_commit_message "$(sed -n '/# Please enter the commit message for your changes. Lines starting/q;p' "$1")"
|
||||
else
|
||||
for commit in $(git rev-list --no-merges origin/master..); do
|
||||
lint_commit_message "$(git log --format="%B" -n 1 $commit)"
|
||||
for COMMIT in $(git rev-list --no-merges origin/master..); do
|
||||
lint_commit_message "$(git log --format="%B" -n 1 ${COMMIT})"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -13,36 +13,31 @@ set -e
|
||||
|
||||
# Disallow usages of functions that cause the program to exit in the library code
|
||||
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||
if [ -f ${SCRIPT_PATH}/.ci.conf ]
|
||||
then
|
||||
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
|
||||
. ${SCRIPT_PATH}/.ci.conf
|
||||
fi
|
||||
|
||||
EXCLUDE_DIRECTORIES=${DISALLOWED_FUNCTIONS_EXCLUDED_DIRECTORIES:-"examples"}
|
||||
DISALLOWED_FUNCTIONS=('os.Exit(' 'panic(' 'Fatal(' 'Fatalf(' 'Fatalln(' 'fmt.Println(' 'fmt.Printf(' 'log.Print(' 'log.Println(' 'log.Printf(' 'print(' 'println(')
|
||||
|
||||
files=$(
|
||||
find "$SCRIPT_PATH/.." -name "*.go" \
|
||||
FILES=$(
|
||||
find "${SCRIPT_PATH}/.." -name "*.go" \
|
||||
| grep -v -e '^.*_test.go$' \
|
||||
| while read file
|
||||
do
|
||||
excluded=false
|
||||
for ex in $EXCLUDE_DIRECTORIES
|
||||
do
|
||||
if [[ $file == */$ex/* ]]
|
||||
then
|
||||
excluded=true
|
||||
| while read FILE; do
|
||||
EXCLUDED=false
|
||||
for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do
|
||||
if [[ ${FILE} == */${EXCLUDE_DIRECTORY}/* ]]; then
|
||||
EXCLUDED=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
$excluded || echo "$file"
|
||||
${EXCLUDED} || echo "${FILE}"
|
||||
done
|
||||
)
|
||||
|
||||
for disallowedFunction in "${DISALLOWED_FUNCTIONS[@]}"
|
||||
do
|
||||
if grep -e "\s$disallowedFunction" $files | grep -v -e 'nolint'; then
|
||||
echo "$disallowedFunction may only be used in example code"
|
||||
for DISALLOWED_FUNCTION in "${DISALLOWED_FUNCTIONS[@]}"; do
|
||||
if grep -e "\s${DISALLOWED_FUNCTION}" ${FILES} | grep -v -e 'nolint'; then
|
||||
echo "${DISALLOWED_FUNCTION} may only be used in example code"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -14,11 +14,11 @@ set -e
|
||||
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||
GO_REGEX="^[a-zA-Z][a-zA-Z0-9_]*\.go$"
|
||||
|
||||
find "$SCRIPT_PATH/.." -name "*.go" | while read fullpath; do
|
||||
filename=$(basename -- "$fullpath")
|
||||
find "${SCRIPT_PATH}/.." -name "*.go" | while read FULLPATH; do
|
||||
FILENAME=$(basename -- "${FULLPATH}")
|
||||
|
||||
if ! [[ $filename =~ $GO_REGEX ]]; then
|
||||
echo "$filename is not a valid filename for Go code, only alpha, numbers and underscores are supported"
|
||||
if ! [[ ${FILENAME} =~ ${GO_REGEX} ]]; then
|
||||
echo "${FILENAME} is not a valid filename for Go code, only alpha, numbers and underscores are supported"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -13,29 +13,25 @@ set -e
|
||||
|
||||
# Disallow usages of functions that cause the program to exit in the library code
|
||||
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||
if [ -f ${SCRIPT_PATH}/.ci.conf ]
|
||||
then
|
||||
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
|
||||
. ${SCRIPT_PATH}/.ci.conf
|
||||
fi
|
||||
|
||||
files=$(
|
||||
find "$SCRIPT_PATH/.." -name "*.go" \
|
||||
| while read file
|
||||
do
|
||||
excluded=false
|
||||
for ex in $EXCLUDE_DIRECTORIES
|
||||
do
|
||||
if [[ $file == */$ex/* ]]
|
||||
then
|
||||
excluded=true
|
||||
FILES=$(
|
||||
find "${SCRIPT_PATH}/.." -name "*.go" \
|
||||
| while read FILE; do
|
||||
EXCLUDED=false
|
||||
for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do
|
||||
if [[ $file == */${EXCLUDE_DIRECTORY}/* ]]; then
|
||||
EXCLUDED=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
$excluded || echo "$file"
|
||||
${EXCLUDED} || echo "${FILE}"
|
||||
done
|
||||
)
|
||||
|
||||
if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' $files | grep -v -e 'nolint'; then
|
||||
if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' ${FILES} | grep -v -e 'nolint'; then
|
||||
echo "Log format strings should have trailing new-line"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user