Skip to content

Commit

Permalink
Merge branch 'master' into feat/refresh-context
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonito committed Mar 4, 2022
2 parents c17cf2f + 8000dd9 commit d55e443
Show file tree
Hide file tree
Showing 23 changed files with 352 additions and 144 deletions.
29 changes: 17 additions & 12 deletions .github/assert-contributors.sh → .github/generate-authors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
set -e

SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
AUTHORS_PATH="$GITHUB_WORKSPACE/AUTHORS.txt"

if [ -f ${SCRIPT_PATH}/.ci.conf ]
then
Expand All @@ -21,18 +22,18 @@ fi
#
# DO NOT EDIT THIS
#
EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion Bot')
EXCLUDED_CONTRIBUTORS+=('John R. Bradley' 'renovate[bot]' 'Renovate Bot' 'Pion Bot' 'pionbot')
# 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=()
CONTRIBUTORS=()

shouldBeIncluded () {
for i in "${EXCLUDED_CONTRIBUTORS[@]}"
do
if [ "$i" == "$1" ] ; then
if [[ $1 =~ "$i" ]]; then
return 1
fi
done
Expand All @@ -41,21 +42,25 @@ shouldBeIncluded () {


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

if [ ${#MISSING_CONTRIBUTORS[@]} -ne 0 ]; then
echo "Please add the following contributors to the README"
for i in "${MISSING_CONTRIBUTORS[@]}"
if [ ${#CONTRIBUTORS[@]} -ne 0 ]; then
cat >$AUTHORS_PATH <<-'EOH'
# Thank you to everyone that made Pion possible. If you are interested in contributing
# we would love to have you https://github.com/pion/webrtc/wiki/Contributing
#
# This file is auto generated, using git to list all individuals contributors.
# see `.github/generate-authors.sh` for the scripting
EOH
for i in "${CONTRIBUTORS[@]}"
do
echo "$i"
echo "$i" >> $AUTHORS_PATH
done
exit 1
exit 0
fi
2 changes: 1 addition & 1 deletion .github/hooks/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

set -e

.github/assert-contributors.sh
.github/generate-authors.sh

exit 0
73 changes: 73 additions & 0 deletions .github/workflows/generate-authors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
# If this repository should have package specific CI config,
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

name: generate-authors

on:
pull_request:

jobs:
checksecret:
runs-on: ubuntu-latest
outputs:
is_PIONBOT_PRIVATE_KEY_set: ${{ steps.checksecret_job.outputs.is_PIONBOT_PRIVATE_KEY_set }}
steps:
- id: checksecret_job
env:
PIONBOT_PRIVATE_KEY: ${{ secrets.PIONBOT_PRIVATE_KEY }}
run: |
echo "is_PIONBOT_PRIVATE_KEY_set: ${{ env.PIONBOT_PRIVATE_KEY != '' }}"
echo "::set-output name=is_PIONBOT_PRIVATE_KEY_set::${{ env.PIONBOT_PRIVATE_KEY != '' }}"
generate-authors:
needs: [checksecret]
if: needs.checksecret.outputs.is_PIONBOT_PRIVATE_KEY_set == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ secrets.PIONBOT_PRIVATE_KEY }}

- name: Generate the authors file
run: .github/generate-authors.sh

- name: Add the authors file to git
run: git add AUTHORS.txt

- name: Get last commit message
id: last-commit-message
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
COMMIT_MSG="${COMMIT_MSG//'%'/'%25'}"
COMMIT_MSG="${COMMIT_MSG//$'\n'/'%0A'}"
COMMIT_MSG="${COMMIT_MSG//$'\r'/'%0D'}"
echo "::set-output name=msg::$COMMIT_MSG"
- name: Get last commit author
id: last-commit-author
run: |
echo "::set-output name=msg::$(git log -1 --pretty='%aN <%ae>')"
- name: Check if AUTHORS.txt file has changed
id: git-status-output
run: |
echo "::set-output name=msg::$(git status -s | wc -l)"
- name: Commit and push
if: ${{ steps.git-status-output.outputs.msg != '0' }}
run: |
git config user.email $(echo "${{ steps.last-commit-author.outputs.msg }}" | sed 's/\(.\+\) <\(\S\+\)>/\2/')
git config user.name $(echo "${{ steps.last-commit-author.outputs.msg }}" | sed 's/\(.\+\) <\(\S\+\)>/\1/')
git add AUTHORS.txt
git commit --amend --no-edit
git push --force https://github.com/${GITHUB_REPOSITORY} $(git symbolic-ref -q --short HEAD)
20 changes: 14 additions & 6 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
# If this repository should have package specific CI config,
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

name: Lint
on:
pull_request:
Expand All @@ -12,7 +23,7 @@ jobs:
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -22,9 +33,6 @@ jobs:
- name: File names
run: .github/lint-filename.sh

- name: Contributors
run: .github/assert-contributors.sh

- name: Functions
run: .github/lint-disallowed-functions-in-library.sh

Expand All @@ -34,10 +42,10 @@ jobs:
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: v1.31
args: $GOLANGCI_LINT_EXRA_ARGS
2 changes: 1 addition & 1 deletion .github/workflows/renovate-go-mod-fix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: fix
Expand Down
74 changes: 47 additions & 27 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#
# DO NOT EDIT THIS FILE
#
# It is automatically copied from https://github.com/pion/.goassets repository.
# If this repository should have package specific CI config,
# remove the repository name from .goassets/.github/workflows/assets-sync.yml.
#
# If you want to update the shared CI config, send a PR to
# https://github.com/pion/.goassets instead of this repository.
#

name: Test
on:
push:
Expand All @@ -11,11 +22,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.15", "1.16"]
go: ["1.16", "1.17"]
fail-fast: false
name: Go ${{ matrix.go }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
with:
Expand All @@ -28,7 +39,7 @@ jobs:
${{ runner.os }}-amd64-go-
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

Expand All @@ -39,11 +50,19 @@ jobs:
- name: Run test
run: |
TEST_BENCH_OPTION="-bench=."
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
go-acc -o cover.out ./... -- \
-bench=. \
-v -race
${TEST_BENCH_OPTION} \
-v -race
- name: Run TEST_HOOK
run: |
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v2
with:
file: ./cover.out
name: codecov-umbrella
Expand All @@ -54,11 +73,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.15", "1.16"]
go: ["1.16", "1.17"]
fail-fast: false
name: Go i386 ${{ matrix.go }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/cache@v2
with:
Expand All @@ -73,30 +92,30 @@ jobs:
run: |
mkdir -p $HOME/go/pkg/mod $HOME/.cache
docker run \
-u $(id -u):$(id -g) \
-e "GO111MODULE=on" \
-e "CGO_ENABLED=0" \
-v $GITHUB_WORKSPACE:/go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \
-v $HOME/go/pkg/mod:/go/pkg/mod \
-v $HOME/.cache:/.cache \
-w /go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \
i386/golang:${{matrix.go}}-alpine \
/usr/local/go/bin/go test \
${TEST_EXTRA_ARGS:-} \
-v ./...
-u $(id -u):$(id -g) \
-e "GO111MODULE=on" \
-e "CGO_ENABLED=0" \
-v $GITHUB_WORKSPACE:/go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \
-v $HOME/go/pkg/mod:/go/pkg/mod \
-v $HOME/.cache:/.cache \
-w /go/src/github.com/pion/$(basename $GITHUB_WORKSPACE) \
i386/golang:${{matrix.go}}-alpine \
/usr/local/go/bin/go test \
${TEST_EXTRA_ARGS:-} \
-v ./...
test-wasm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: WASM
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '12.x'
node-version: '16.x'

- uses: actions/cache@v2
with:
Expand All @@ -110,7 +129,7 @@ jobs:
- name: Download Go
run: curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf -
env:
GO_VERSION: 1.16
GO_VERSION: 1.17

- name: Set Go Root
run: echo "GOROOT=${HOME}/go" >> $GITHUB_ENV
Expand All @@ -126,12 +145,13 @@ jobs:

- name: Run Tests
run: |
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
GOOS=js GOARCH=wasm $GOPATH/bin/go test \
-coverprofile=cover.out -covermode=atomic \
-exec="${GO_JS_WASM_EXEC}" \
-v ./...
-coverprofile=cover.out -covermode=atomic \
-exec="${GO_JS_WASM_EXEC}" \
-v ./...
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v2
with:
file: ./cover.out
name: codecov-umbrella
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tidy-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
- name: check
run: |
go mod download
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ cover.out
*.wasm
examples/sfu-ws/cert.pem
examples/sfu-ws/key.pem
wasm_exec.js
27 changes: 27 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Thank you to everyone that made Pion possible. If you are interested in contributing
# we would love to have you https://github.com/pion/webrtc/wiki/Contributing
#
# This file is auto generated, using git to list all individuals contributors.
# see `.github/generate-authors.sh` for the scripting
adamroach <[email protected]>
Agniva De Sarker <[email protected]>
Antoine Baché <[email protected]>
Atsushi Watanabe <[email protected]>
backkem <[email protected]>
chenkaiC4 <[email protected]>
Chris Hiszpanski <[email protected]>
cszdlt <[email protected]>
Hugo Arregui <[email protected]>
Jerko Steiner <[email protected]>
Juliusz Chroboczek <[email protected]>
Luke Curley <[email protected]>
Luke Curley <[email protected]>
Max Hawkins <[email protected]>
mission-liao <[email protected]>
Novel Corpse <[email protected]>
OrlandoCo <[email protected]>
Sean DuBois <[email protected]>
Sean DuBois <[email protected]>
Tobias Fridén <[email protected]>
Woodrow Douglass <[email protected]>
Yutaka Takeda <[email protected]>
Loading

0 comments on commit d55e443

Please sign in to comment.