Skip to content

Commit

Permalink
Revert to 4e87540 (last commit before v2)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored and Sean-Der committed Jun 14, 2023
1 parent c5ca73a commit 6e39a73
Show file tree
Hide file tree
Showing 76 changed files with 910 additions and 4,617 deletions.
4 changes: 0 additions & 4 deletions .github/.gitignore

This file was deleted.

61 changes: 61 additions & 0 deletions .github/assert-contributors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

set -e

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

if [ -f ${SCRIPT_PATH}/.ci.conf ]
then
. ${SCRIPT_PATH}/.ci.conf
fi

#
# DO NOT EDIT THIS
#
EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion Bot')
# If you want to exclude a name from all repositories, send a PR to
# https://github.com/pion/.goassets instead of this repository.
# If you want to exclude a name only from this repository,
# add EXCLUDED_CONTRIBUTORS=('name') to .github/.ci.conf

MISSING_CONTRIBUTORS=()

shouldBeIncluded () {
for i in "${EXCLUDED_CONTRIBUTORS[@]}"
do
if [ "$i" == "$1" ] ; then
return 1
fi
done
return 0
}


IFS=$'\n' #Only split on newline
for contributor in $(git log --format='%aN' | sort -u)
do
if shouldBeIncluded $contributor; then
if ! grep -q "$contributor" "$SCRIPT_PATH/../README.md"; then
MISSING_CONTRIBUTORS+=("$contributor")
fi
fi
done
unset IFS

if [ ${#MISSING_CONTRIBUTORS[@]} -ne 0 ]; then
echo "Please add the following contributors to the README"
for i in "${MISSING_CONTRIBUTORS[@]}"
do
echo "$i"
done
exit 1
fi
31 changes: 0 additions & 31 deletions .github/fetch-scripts.sh

This file was deleted.

11 changes: 11 additions & 0 deletions .github/hooks/commit-msg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#

set -e

.github/lint-commit-message.sh $1
12 changes: 12 additions & 0 deletions .github/hooks/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#

# Redirect output to stderr.
exec 1>&2

.github/lint-disallowed-functions-in-library.sh
13 changes: 13 additions & 0 deletions .github/hooks/pre-push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#

set -e

.github/assert-contributors.sh

exit 0
14 changes: 5 additions & 9 deletions .github/install-hooks.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

#
# DO NOT EDIT THIS FILE
Expand All @@ -8,13 +8,9 @@
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

SCRIPT_PATH="$(realpath "$(dirname "$0")")"
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

. ${SCRIPT_PATH}/fetch-scripts.sh

cp "${GOASSETS_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg"
cp "${GOASSETS_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit"
cp "${GOASSETS_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"
64 changes: 64 additions & 0 deletions .github/lint-commit-message.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

set -e

display_commit_message_error() {
cat << EndOfMessage
$1
-------------------------------------------------
The preceding commit message is invalid
it failed '$2' of the following checks
* Separate subject from body with a blank line
* Limit the subject line to 50 characters
* Capitalize the subject line
* Do not end the subject line with a period
* Wrap the body at 72 characters
EndOfMessage

exit 1
}

lint_commit_message() {
if [[ "$(echo "$1" | awk 'NR == 2 {print $1;}' | wc -c)" -ne 1 ]]; then
display_commit_message_error "$1" 'Separate subject from body with a blank line'
fi

if [[ "$(echo "$1" | head -n1 | awk '{print length}')" -gt 50 ]]; then
display_commit_message_error "$1" 'Limit the subject line to 50 characters'
fi

if [[ ! $1 =~ ^[A-Z] ]]; then
display_commit_message_error "$1" 'Capitalize the subject line'
fi

if [[ "$(echo "$1" | awk 'NR == 1 {print substr($0,length($0),1)}')" == "." ]]; then
display_commit_message_error "$1" 'Do not end the subject line with a period'
fi

if [[ "$(echo "$1" | awk '{print length}' | sort -nr | head -1)" -gt 72 ]]; then
display_commit_message_error "$1" 'Wrap the body at 72 characters'
fi
}

if [ "$#" -eq 1 ]; then
if [ ! -f "$1" ]; then
echo "$0 was passed one argument, but was not a valid file"
exit 1
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)"
done
fi
48 changes: 48 additions & 0 deletions .github/lint-disallowed-functions-in-library.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

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
. ${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" \
| grep -v -e '^.*_test.go$' \
| while read file
do
excluded=false
for ex in $EXCLUDE_DIRECTORIES
do
if [[ $file == */$ex/* ]]
then
excluded=true
break
fi
done
$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"
exit 1
fi
done
24 changes: 24 additions & 0 deletions .github/lint-filename.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

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")

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
28 changes: 0 additions & 28 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/generate-authors.yml

This file was deleted.

Loading

0 comments on commit 6e39a73

Please sign in to comment.