mirror of
				https://github.com/pion/webrtc.git
				synced 2025-10-31 18:52:55 +08:00 
			
		
		
		
	Update CI configs to v0.1.3
Update lint scripts and CI configs.
This commit is contained in:
		
							
								
								
									
										9
									
								
								.github/assert-contributors.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/assert-contributors.sh
									
									
									
									
										vendored
									
									
								
							| @@ -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 () { | ||||
|   | ||||
							
								
								
									
										7
									
								
								.github/hooks/commit-msg.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/hooks/commit-msg.sh
									
									
									
									
										vendored
									
									
								
							| @@ -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 | ||||
|  | ||||
| .github/lint-commit-message.sh $1 | ||||
|   | ||||
							
								
								
									
										6
									
								
								.github/hooks/pre-commit.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/hooks/pre-commit.sh
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,11 @@ | ||||
| #!/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 | ||||
|  | ||||
|   | ||||
							
								
								
									
										6
									
								
								.github/hooks/pre-push.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/hooks/pre-push.sh
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,11 @@ | ||||
| #!/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 | ||||
|   | ||||
							
								
								
									
										6
									
								
								.github/install-hooks.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/install-hooks.sh
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,11 @@ | ||||
| #!/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" | ||||
|   | ||||
							
								
								
									
										9
									
								
								.github/lint-commit-message.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/lint-commit-message.sh
									
									
									
									
										vendored
									
									
								
							| @@ -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() { | ||||
| @@ -24,7 +31,7 @@ lint_commit_message() { | ||||
|         display_commit_message_error "$1" 'Separate subject from body with a blank line' | ||||
|     fi | ||||
|  | ||||
|     if [[ "$(echo "$1" | head -n1 | wc -m)" -gt 50 ]]; then | ||||
|     if [[ "$(echo "$1" | head -n1 | awk '{print length}')" -gt 50 ]]; then | ||||
|         display_commit_message_error "$1" 'Limit the subject line to 50 characters' | ||||
|     fi | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|  | ||||
| # Disallow usages of functions that cause the program to exit in the library code | ||||
|   | ||||
							
								
								
									
										11
									
								
								.github/lint-filename.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								.github/lint-filename.sh
									
									
									
									
										vendored
									
									
								
							| @@ -1,14 +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$" | ||||
| GO_REGEX="^[a-zA-Z][a-zA-Z0-9_]*\.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" | ||||
|       echo "$filename is not a valid filename for Go code, only alpha, numbers and underscores are supported" | ||||
|       exit 1 | ||||
|   fi | ||||
| done | ||||
|   | ||||
							
								
								
									
										144
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										144
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -1,86 +1,130 @@ | ||||
| # | ||||
| # DO NOT EDIT THIS FILE DIRECTLY | ||||
| # | ||||
| # 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. | ||||
| # | ||||
|  | ||||
| dist: bionic | ||||
| language: go | ||||
| go: | ||||
|   - 1.13 | ||||
|  | ||||
|  | ||||
| branches: | ||||
|   only: | ||||
|   - master | ||||
|  | ||||
| cache: | ||||
|   directories: | ||||
|     - $HOME/.cache/go-build | ||||
|     - $HOME/gopath/pkg/mod | ||||
|   npm: true | ||||
|   yarn: true | ||||
|  | ||||
| env: | ||||
|   global: | ||||
|     - GO111MODULE=on | ||||
|     - GO_VERSION=1.13 | ||||
|     - GOLANGCI_LINT_VERSION=1.19.1 | ||||
|  | ||||
| cache: | ||||
|   directories: | ||||
|     - ${HOME}/.cache/go-build | ||||
|     - ${GOPATH}/pkg/mod | ||||
|   npm: true | ||||
|   yarn: true | ||||
|  | ||||
| jobs: | ||||
|   include: | ||||
|     - name: Lint | ||||
| lint_job: &lint_job | ||||
|   env: CACHE_NAME=lint | ||||
|   before_script: | ||||
|         - go get -u github.com/sean-der/godox | ||||
|     - | | ||||
|       curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ | ||||
|         | bash -s - -b $GOPATH/bin v${GOLANGCI_LINT_VERSION} | ||||
|       install: true | ||||
|   install: skip | ||||
|   script: | ||||
|     - bash .github/assert-contributors.sh | ||||
|     - bash .github/lint-disallowed-functions-in-library.sh | ||||
|     - bash .github/lint-commit-message.sh | ||||
|     - bash .github/lint-filename.sh | ||||
|         - godox | ||||
|         - golangci-lint run --build-tags quic ./... | ||||
|     - name: Go | ||||
|       env: CACHE_NAME=go | ||||
|       install: true | ||||
|     - golangci-lint run ./... | ||||
| test_job: &test_job | ||||
|   env: CACHE_NAME=test | ||||
|   before_install: | ||||
|     - go mod download | ||||
|   install: | ||||
|     - go build ./... | ||||
|   script: | ||||
|     - coverpkgs=$(go list ./... | grep -v examples | paste -s -d ',') | ||||
|     - | | ||||
|           go test -tags quic \ | ||||
|       go test \ | ||||
|         -coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \ | ||||
|         -tags quic \ | ||||
|         -v -race ./... | ||||
|   after_success: | ||||
|         - bash <(curl -s https://codecov.io/bash) -c -F go | ||||
|     - name: WASM | ||||
|       env: CACHE_NAME=wasm | ||||
|       language: node_js | ||||
|       node_js: | ||||
|         - 12 | ||||
|       install: | ||||
|         # Manually download and install Go instead of using gimme. | ||||
|         # It looks like gimme Go causes some errors on go-test for Wasm. | ||||
|         - curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf - | ||||
|         - export GOROOT=~/go | ||||
|         - export PATH=$GOROOT/bin:$PATH | ||||
|         - yarn install | ||||
|       script: | ||||
|         - coverpkgs=$(go list ./... | paste -s -d ',') | ||||
|         - | | ||||
|           GOOS=js GOARCH=wasm go test \ | ||||
|             -coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \ | ||||
|             -exec="./test-wasm/go_js_wasm_exec" -v . | ||||
|       after_success: | ||||
|         - bash <(curl -s https://codecov.io/bash) -c -F wasm | ||||
|     - name: Go on i386 | ||||
|       env: CACHE_NAME=go386 | ||||
|     - travis_retry bash <(curl -s https://codecov.io/bash) -c -F go | ||||
| test_i386_job: &test_i386_job | ||||
|   env: CACHE_NAME=test386 | ||||
|   language: bash | ||||
|   services: docker | ||||
|   install: | ||||
|     # i386/golang:1.12-alpine doesn't have git. | ||||
|     - echo -e "FROM i386/golang:${GO_VERSION}-alpine\nRUN apk add --no-cache git" > Dockerfile | ||||
|     - docker build -t go-tester . | ||||
|   script: | ||||
|     - | | ||||
|       docker run \ | ||||
|         -u $(id -u):$(id -g) \ | ||||
|         -e "GO111MODULE=on" \ | ||||
|         -e "CGO_ENABLED=0" \ | ||||
|             -v $PWD:/go/src/github.com/pion/webrtc \ | ||||
|             -v $HOME/gopath/pkg/mod:/go/pkg/mod \ | ||||
|             -v $HOME/.cache/go-build:/.cache/go-build \ | ||||
|             -w /go/src/github.com/pion/webrtc \ | ||||
|             -it i386/golang:${GO_VERSION}-alpine \ | ||||
|             /usr/local/go/bin/go test -tags quic -v ./... | ||||
|         -v ${PWD}:/go/src/github.com/pion/$(basename ${PWD}) \ | ||||
|         -v ${HOME}/gopath/pkg/mod:/go/pkg/mod \ | ||||
|         -v ${HOME}/.cache/go-build:/.cache/go-build \ | ||||
|         -w /go/src/github.com/pion/$(basename ${PWD}) \ | ||||
|         -it go-tester \ | ||||
|         /usr/local/go/bin/go test \ | ||||
|           -tags quic \ | ||||
|           -v ./... | ||||
| test_wasm_job: &test_wasm_job | ||||
|   env: CACHE_NAME=wasm | ||||
|   language: node_js | ||||
|   node_js: 12 | ||||
|   install: | ||||
|     # Manually download and install Go instead of using gimme. | ||||
|     # It looks like gimme Go causes some errors on go-test for Wasm. | ||||
|     - curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf - | ||||
|     - export GOROOT=${HOME}/go | ||||
|     - export PATH=${GOROOT}/bin:${PATH} | ||||
|     - yarn install | ||||
|     - export GO_JS_WASM_EXEC=${GOROOT}/misc/wasm/go_js_wasm_exec | ||||
|     # If the repository has wasm_exec hook, use it. | ||||
|     - | | ||||
|       if [ -f test-wasm/go_js_wasm_exec ]; then | ||||
|         export GO_JS_WASM_EXEC=${PWD}/test-wasm/go_js_wasm_exec | ||||
|       fi | ||||
|   script: | ||||
|     - testpkgs=$(go list ./... | grep -v examples) | ||||
|     - coverpkgs=$(go list ./... | grep -v examples | paste -s -d ',') | ||||
|     - | | ||||
|       GOOS=js GOARCH=wasm go test \ | ||||
|         -coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \ | ||||
|         -exec="${GO_JS_WASM_EXEC}" \ | ||||
|         -v ${testpkgs} | ||||
|   after_success: | ||||
|     - travis_retry bash <(curl -s https://codecov.io/bash) -c -F wasm | ||||
|  | ||||
| jobs: | ||||
|   include: | ||||
|     - <<: *lint_job | ||||
|       name: Lint 1.13 | ||||
|       go: 1.13 | ||||
|     - <<: *test_job | ||||
|       name: Test 1.12 | ||||
|       go: 1.12 | ||||
|     - <<: *test_job | ||||
|       name: Test 1.13 | ||||
|       go: 1.13 | ||||
|     - <<: *test_i386_job | ||||
|       name: Test i386 1.12 | ||||
|       env: GO_VERSION=1.12 | ||||
|     - <<: *test_i386_job | ||||
|       name: Test i386 1.13 | ||||
|       env: GO_VERSION=1.13 | ||||
|     - <<: *test_wasm_job | ||||
|       name: Test WASM 1.13 | ||||
|       # Requires Go1.13 syscall/js | ||||
|       env: GO_VERSION=1.13 | ||||
|  | ||||
| notifications: | ||||
|   email: false | ||||
|   | ||||
| @@ -1,3 +1,9 @@ | ||||
| # | ||||
| # DO NOT EDIT THIS FILE DIRECTLY | ||||
| # | ||||
| # It is automatically copied from https://github.com/pion/.goassets repository. | ||||
| # | ||||
|  | ||||
| coverage: | ||||
|   status: | ||||
|     project: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Pion
					Pion