From 961bcb4e7e21e353d62c6612c87e3fc97aa15432 Mon Sep 17 00:00:00 2001 From: Pion <59523206+pionbot@users.noreply.github.com> Date: Fri, 10 Jan 2020 06:20:39 +0000 Subject: [PATCH] Update assets to v0.0.2 Update lint scripts and CI configs. --- .github/assert-contributors.sh | 9 +++++++- .github/hooks/commit-msg.sh | 11 ++++++++++ .github/hooks/pre-commit.sh | 12 +++++++++++ .github/hooks/pre-push.sh | 13 ++++++++++++ .github/install-hooks.sh | 13 ++++++++++++ .github/lint-commit-message.sh | 7 +++++++ .../lint-disallowed-functions-in-library.sh | 9 +++++++- .github/lint-filename.sh | 21 +++++++++++++++++++ codecov.yml | 19 +++++++++++++++++ 9 files changed, 112 insertions(+), 2 deletions(-) create mode 100755 .github/hooks/commit-msg.sh create mode 100755 .github/hooks/pre-commit.sh create mode 100755 .github/hooks/pre-push.sh create mode 100755 .github/install-hooks.sh create mode 100755 .github/lint-filename.sh create mode 100644 codecov.yml diff --git a/.github/assert-contributors.sh b/.github/assert-contributors.sh index 1d92e5c..915f680 100755 --- a/.github/assert-contributors.sh +++ b/.github/assert-contributors.sh @@ -1,4 +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 # Unshallow the repo, this check doesn't work with this enabled @@ -9,7 +16,7 @@ fi SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -EXCLUDED_CONTIBUTORS=('John R. Bradley' 'renovate[bot]' 'Renovate Bot') +EXCLUDED_CONTIBUTORS=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion Bot') MISSING_CONTIBUTORS=() shouldBeIncluded () { diff --git a/.github/hooks/commit-msg.sh b/.github/hooks/commit-msg.sh new file mode 100755 index 0000000..8213dc2 --- /dev/null +++ b/.github/hooks/commit-msg.sh @@ -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 diff --git a/.github/hooks/pre-commit.sh b/.github/hooks/pre-commit.sh new file mode 100755 index 0000000..cc318d7 --- /dev/null +++ b/.github/hooks/pre-commit.sh @@ -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 diff --git a/.github/hooks/pre-push.sh b/.github/hooks/pre-push.sh new file mode 100755 index 0000000..7cb2365 --- /dev/null +++ b/.github/hooks/pre-push.sh @@ -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 diff --git a/.github/install-hooks.sh b/.github/install-hooks.sh new file mode 100755 index 0000000..289bdbb --- /dev/null +++ b/.github/install-hooks.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# +# DO NOT EDIT THIS FILE DIRECTLY +# +# It is automatically copied from https://github.com/pion/.goassets repository. +# + +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" diff --git a/.github/lint-commit-message.sh b/.github/lint-commit-message.sh index df2ea30..6962750 100755 --- a/.github/lint-commit-message.sh +++ b/.github/lint-commit-message.sh @@ -1,4 +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 display_commit_message_error() { diff --git a/.github/lint-disallowed-functions-in-library.sh b/.github/lint-disallowed-functions-in-library.sh index f7e90f2..f5c9d87 100755 --- a/.github/lint-disallowed-functions-in-library.sh +++ b/.github/lint-disallowed-functions-in-library.sh @@ -1,9 +1,16 @@ #!/usr/bin/env bash + +# +# DO NOT EDIT THIS FILE DIRECTLY +# +# It is automatically copied from https://github.com/pion/.goassets 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 ) -EXCLUDE_DIRECTORIES="--exclude-dir=examples --exclude-dir=e2e --exclude-dir=.git --exclude-dir=.github " +EXCLUDE_DIRECTORIES="--exclude-dir=examples --exclude-dir=.git --exclude-dir=.github " DISALLOWED_FUNCTIONS=('os.Exit(' 'panic(' 'Fatal(' 'Fatalf(' 'Fatalln(' 'fmt.Println(' 'fmt.Printf(' 'log.Print(' 'log.Println(' 'log.Printf(') diff --git a/.github/lint-filename.sh b/.github/lint-filename.sh new file mode 100755 index 0000000..91187c1 --- /dev/null +++ b/.github/lint-filename.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# +# DO NOT EDIT THIS FILE DIRECTLY +# +# It is automatically copied from https://github.com/pion/.goassets repository. +# + +set -e + +SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +GO_REGEX="^[a-zA-Z_]+\.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 and underscores are supported" + exit 1 + fi +done diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..4b72e53 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,19 @@ +# +# DO NOT EDIT THIS FILE DIRECTLY +# +# It is automatically copied from https://github.com/pion/.goassets repository. +# + +coverage: + status: + project: + default: + # Allow decreasing 2% of total coverage to avoid noise. + threshold: 2% + patch: + default: + target: 70% + +ignore: + - "examples/*" + - "examples/**/*"