Skip to content

Commit 95ca464

Browse files
pionbotat-wat
authored andcommittedJan 10, 2023
Update CI configs to v0.9.0
Update lint scripts and CI configs.
1 parent b35b52f commit 95ca464

9 files changed

+55
-61
lines changed
 

‎.github/generate-authors.sh

+16-13
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
set -e
1313

1414
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
15-
AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt"
15+
if [ -z "${AUTHORS_PATH}" ]; then
16+
AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt"
17+
fi
1618

17-
if [ -f ${SCRIPT_PATH}/.ci.conf ]
18-
then
19+
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
1920
. ${SCRIPT_PATH}/.ci.conf
2021
fi
2122

@@ -31,8 +32,7 @@ EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion B
3132
CONTRIBUTORS=()
3233

3334
shouldBeIncluded () {
34-
for i in "${EXCLUDED_CONTRIBUTORS[@]}"
35-
do
35+
for i in "${EXCLUDED_CONTRIBUTORS[@]}"; do
3636
if [[ $1 =~ "$i" ]]; then
3737
return 1
3838
fi
@@ -42,25 +42,28 @@ shouldBeIncluded () {
4242

4343

4444
IFS=$'\n' #Only split on newline
45-
for contributor in $(git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf)
46-
do
47-
if shouldBeIncluded $contributor; then
48-
CONTRIBUTORS+=("$contributor")
45+
for CONTRIBUTOR in $(
46+
(
47+
git log --format='%aN <%aE>'
48+
git log --format='%(trailers:key=Co-authored-by)' | sed -n 's/^[^:]*:\s*//p'
49+
) | LC_ALL=C.UTF-8 sort -uf
50+
); do
51+
if shouldBeIncluded ${CONTRIBUTOR}; then
52+
CONTRIBUTORS+=("${CONTRIBUTOR}")
4953
fi
5054
done
5155
unset IFS
5256

5357
if [ ${#CONTRIBUTORS[@]} -ne 0 ]; then
54-
cat >$AUTHORS_PATH <<-'EOH'
58+
cat >${AUTHORS_PATH} <<-'EOH'
5559
# Thank you to everyone that made Pion possible. If you are interested in contributing
5660
# we would love to have you https://github.com/pion/webrtc/wiki/Contributing
5761
#
5862
# This file is auto generated, using git to list all individuals contributors.
5963
# see `.github/generate-authors.sh` for the scripting
6064
EOH
61-
for i in "${CONTRIBUTORS[@]}"
62-
do
63-
echo "$i" >> $AUTHORS_PATH
65+
for i in "${CONTRIBUTORS[@]}"; do
66+
echo "$i" >> ${AUTHORS_PATH}
6467
done
6568
exit 0
6669
fi

‎.github/install-hooks.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

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

14-
cp "$SCRIPT_PATH/hooks/commit-msg.sh" "$SCRIPT_PATH/../.git/hooks/commit-msg"
15-
cp "$SCRIPT_PATH/hooks/pre-commit.sh" "$SCRIPT_PATH/../.git/hooks/pre-commit"
16-
cp "$SCRIPT_PATH/hooks/pre-push.sh" "$SCRIPT_PATH/../.git/hooks/pre-push"
14+
cp "${SCRIPT_PATH}/hooks/commit-msg.sh" "${SCRIPT_PATH}/../.git/hooks/commit-msg"
15+
cp "${SCRIPT_PATH}/hooks/pre-commit.sh" "${SCRIPT_PATH}/../.git/hooks/pre-commit"
16+
cp "${SCRIPT_PATH}/hooks/pre-push.sh" "${SCRIPT_PATH}/../.git/hooks/pre-push"

‎.github/lint-commit-message.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if [ "$#" -eq 1 ]; then
5858
fi
5959
lint_commit_message "$(sed -n '/# Please enter the commit message for your changes. Lines starting/q;p' "$1")"
6060
else
61-
for commit in $(git rev-list --no-merges origin/master..); do
62-
lint_commit_message "$(git log --format="%B" -n 1 $commit)"
61+
for COMMIT in $(git rev-list --no-merges origin/master..); do
62+
lint_commit_message "$(git log --format="%B" -n 1 ${COMMIT})"
6363
done
6464
fi

‎.github/lint-disallowed-functions-in-library.sh

+12-17
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,31 @@ set -e
1313

1414
# Disallow usages of functions that cause the program to exit in the library code
1515
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
16-
if [ -f ${SCRIPT_PATH}/.ci.conf ]
17-
then
16+
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
1817
. ${SCRIPT_PATH}/.ci.conf
1918
fi
2019

2120
EXCLUDE_DIRECTORIES=${DISALLOWED_FUNCTIONS_EXCLUDED_DIRECTORIES:-"examples"}
2221
DISALLOWED_FUNCTIONS=('os.Exit(' 'panic(' 'Fatal(' 'Fatalf(' 'Fatalln(' 'fmt.Println(' 'fmt.Printf(' 'log.Print(' 'log.Println(' 'log.Printf(' 'print(' 'println(')
2322

24-
files=$(
25-
find "$SCRIPT_PATH/.." -name "*.go" \
23+
FILES=$(
24+
find "${SCRIPT_PATH}/.." -name "*.go" \
2625
| grep -v -e '^.*_test.go$' \
27-
| while read file
28-
do
29-
excluded=false
30-
for ex in $EXCLUDE_DIRECTORIES
31-
do
32-
if [[ $file == */$ex/* ]]
33-
then
34-
excluded=true
26+
| while read FILE; do
27+
EXCLUDED=false
28+
for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do
29+
if [[ ${FILE} == */${EXCLUDE_DIRECTORY}/* ]]; then
30+
EXCLUDED=true
3531
break
3632
fi
3733
done
38-
$excluded || echo "$file"
34+
${EXCLUDED} || echo "${FILE}"
3935
done
4036
)
4137

42-
for disallowedFunction in "${DISALLOWED_FUNCTIONS[@]}"
43-
do
44-
if grep -e "\s$disallowedFunction" $files | grep -v -e 'nolint'; then
45-
echo "$disallowedFunction may only be used in example code"
38+
for DISALLOWED_FUNCTION in "${DISALLOWED_FUNCTIONS[@]}"; do
39+
if grep -e "\s${DISALLOWED_FUNCTION}" ${FILES} | grep -v -e 'nolint'; then
40+
echo "${DISALLOWED_FUNCTION} may only be used in example code"
4641
exit 1
4742
fi
4843
done

‎.github/lint-filename.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ set -e
1414
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
1515
GO_REGEX="^[a-zA-Z][a-zA-Z0-9_]*\.go$"
1616

17-
find "$SCRIPT_PATH/.." -name "*.go" | while read fullpath; do
18-
filename=$(basename -- "$fullpath")
17+
find "${SCRIPT_PATH}/.." -name "*.go" | while read FULLPATH; do
18+
FILENAME=$(basename -- "${FULLPATH}")
1919

20-
if ! [[ $filename =~ $GO_REGEX ]]; then
21-
echo "$filename is not a valid filename for Go code, only alpha, numbers and underscores are supported"
20+
if ! [[ ${FILENAME} =~ ${GO_REGEX} ]]; then
21+
echo "${FILENAME} is not a valid filename for Go code, only alpha, numbers and underscores are supported"
2222
exit 1
2323
fi
2424
done

‎.github/lint-no-trailing-newline-in-log-messages.sh

+10-14
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,25 @@ set -e
1313

1414
# Disallow usages of functions that cause the program to exit in the library code
1515
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
16-
if [ -f ${SCRIPT_PATH}/.ci.conf ]
17-
then
16+
if [ -f ${SCRIPT_PATH}/.ci.conf ]; then
1817
. ${SCRIPT_PATH}/.ci.conf
1918
fi
2019

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
20+
FILES=$(
21+
find "${SCRIPT_PATH}/.." -name "*.go" \
22+
| while read FILE; do
23+
EXCLUDED=false
24+
for EXCLUDE_DIRECTORY in ${EXCLUDE_DIRECTORIES}; do
25+
if [[ $file == */${EXCLUDE_DIRECTORY}/* ]]; then
26+
EXCLUDED=true
3127
break
3228
fi
3329
done
34-
$excluded || echo "$file"
30+
${EXCLUDED} || echo "${FILE}"
3531
done
3632
)
3733

38-
if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' $files | grep -v -e 'nolint'; then
34+
if grep -E '\.(Trace|Debug|Info|Warn|Error)f?\("[^"]*\\n"\)?' ${FILES} | grep -v -e 'nolint'; then
3935
echo "Log format strings should have trailing new-line"
4036
exit 1
4137
fi

‎.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
go-version: '1.18' # auto-update/latest-go-version
1919
- name: Build and release
20-
uses: goreleaser/goreleaser-action@v3
20+
uses: goreleaser/goreleaser-action@v4
2121
with:
2222
version: latest
2323
args: release --rm-dist

‎.github/workflows/test.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
strategy:
2828
matrix:
29-
go: ["1.17", "1.18"] # auto-update/supported-go-version-list
29+
go: ['1.19', '1.18'] # auto-update/supported-go-version-list
3030
fail-fast: false
3131
name: Go ${{ matrix.go }}
3232
steps:
@@ -67,7 +67,7 @@ jobs:
6767
-v -race 2>&1 | grep -v '^go: downloading' | tee /tmp/gotest.log | gotestfmt
6868
6969
- name: Upload test log
70-
uses: actions/upload-artifact@v2
70+
uses: actions/upload-artifact@v3
7171
if: always()
7272
with:
7373
name: test-log-${{ matrix.go }}
@@ -79,7 +79,7 @@ jobs:
7979
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
8080
if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi
8181
82-
- uses: codecov/codecov-action@v2
82+
- uses: codecov/codecov-action@v3
8383
with:
8484
name: codecov-umbrella
8585
fail_ci_if_error: true
@@ -89,7 +89,7 @@ jobs:
8989
runs-on: ubuntu-latest
9090
strategy:
9191
matrix:
92-
go: ["1.17", "1.18"] # auto-update/supported-go-version-list
92+
go: ['1.19', '1.18'] # auto-update/supported-go-version-list
9393
fail-fast: false
9494
name: Go i386 ${{ matrix.go }}
9595
steps:
@@ -145,7 +145,7 @@ jobs:
145145
- name: Download Go
146146
run: curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf -
147147
env:
148-
GO_VERSION: 1.17 # auto-update/latest-go-version
148+
GO_VERSION: '1.19' # auto-update/latest-go-version
149149

150150
- name: Set Go Root
151151
run: echo "GOROOT=${HOME}/go" >> $GITHUB_ENV
@@ -167,7 +167,7 @@ jobs:
167167
-exec="${GO_JS_WASM_EXEC}" \
168168
-v ./...
169169
170-
- uses: codecov/codecov-action@v2
170+
- uses: codecov/codecov-action@v3
171171
with:
172172
name: codecov-umbrella
173173
fail_ci_if_error: true

‎.github/workflows/tidy-check.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Setup Go
3131
uses: actions/setup-go@v3
3232
with:
33-
go-version: 1.17 # auto-update/latest-go-version
33+
go-version: '1.19' # auto-update/latest-go-version
3434
- name: check
3535
run: |
3636
go mod download

0 commit comments

Comments
 (0)
Please sign in to comment.