Skip to content

Commit 943f5ca

Browse files
pionbotSean-Der
authored andcommitted
Update CI configs to v0.7.5
Update lint scripts and CI configs.
1 parent 2a9c68d commit 943f5ca

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

.github/hooks/pre-commit.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
exec 1>&2
1111

1212
.github/lint-disallowed-functions-in-library.sh
13+
.github/lint-no-trailing-newline-in-log-messages.sh
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# DO NOT EDIT THIS FILE
5+
#
6+
# It is automatically copied from https://github.com/pion/.goassets repository.
7+
#
8+
# If you want to update the shared CI config, send a PR to
9+
# https://github.com/pion/.goassets instead of this repository.
10+
#
11+
12+
set -e
13+
14+
# Disallow usages of functions that cause the program to exit in the library code
15+
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
16+
if [ -f ${SCRIPT_PATH}/.ci.conf ]
17+
then
18+
. ${SCRIPT_PATH}/.ci.conf
19+
fi
20+
21+
files=$(
22+
find "$SCRIPT_PATH/.." -name "*.go" \
23+
| while read file
24+
do
25+
excluded=false
26+
for ex in $EXCLUDE_DIRECTORIES
27+
do
28+
if [[ $file == */$ex/* ]]
29+
then
30+
excluded=true
31+
break
32+
fi
33+
done
34+
$excluded || echo "$file"
35+
done
36+
)
37+
38+
if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' $files | grep -v -e 'nolint'; then
39+
echo "Log format strings should have trailing new-line"
40+
exit 1
41+
fi

.github/workflows/codeql-analysis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ jobs:
1818
- name: Checkout repo
1919
uses: actions/checkout@v3
2020

21+
# The code in examples/ might intentionally do things like log credentials
22+
# in order to show how the library is used, aid in debugging etc. We
23+
# should ignore those for CodeQL scanning, and only focus on the package
24+
# itself.
25+
- name: Remove example code
26+
run: |
27+
rm -rf examples/
28+
2129
- name: Initialize CodeQL
2230
uses: github/codeql-action/init@v2
2331
with:

.github/workflows/lint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
- name: Functions
3737
run: .github/lint-disallowed-functions-in-library.sh
3838

39+
- name: Logging messages should not have trailing newlines
40+
run: .github/lint-no-trailing-newline-in-log-messages.sh
41+
3942
lint-go:
4043
name: Go
4144
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)