Update CI configs to v0.7.5

Update lint scripts and CI configs.
This commit is contained in:
Pion
2022-05-09 14:05:03 +00:00
committed by Sean DuBois
parent a6c749437b
commit 5b4afbb934
6 changed files with 62 additions and 9 deletions

View File

@@ -10,3 +10,4 @@
exec 1>&2
.github/lint-disallowed-functions-in-library.sh
.github/lint-no-trailing-newline-in-log-messages.sh

View File

@@ -0,0 +1,41 @@
#!/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
files=$(
find "$SCRIPT_PATH/.." -name "*.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
)
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

View File

@@ -18,6 +18,14 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v3
# The code in examples/ might intentionally do things like log credentials
# in order to show how the library is used, aid in debugging etc. We
# should ignore those for CodeQL scanning, and only focus on the package
# itself.
- name: Remove example code
run: |
rm -rf examples/
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:

View File

@@ -36,6 +36,9 @@ jobs:
- name: Functions
run: .github/lint-disallowed-functions-in-library.sh
- name: Logging messages should not have trailing newlines
run: .github/lint-no-trailing-newline-in-log-messages.sh
lint-go:
name: Go
runs-on: ubuntu-latest