Update CI configs to v0.1.3

Update lint scripts and CI configs.
This commit is contained in:
Pion
2020-01-23 23:43:21 +00:00
committed by Luke S
parent 20f2d1899e
commit 9d0d1e8e2e
10 changed files with 179 additions and 76 deletions

View File

@@ -1,4 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
set -e set -e
# Unshallow the repo, this check doesn't work with this enabled # 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 ) 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=() MISSING_CONTIBUTORS=()
shouldBeIncluded () { shouldBeIncluded () {

View File

@@ -1,4 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
set -e set -e
.github/lint-commit-message.sh $1 .github/lint-commit-message.sh $1

View File

@@ -1,5 +1,11 @@
#!/bin/sh #!/bin/sh
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
# Redirect output to stderr. # Redirect output to stderr.
exec 1>&2 exec 1>&2

View File

@@ -1,5 +1,11 @@
#!/bin/sh #!/bin/sh
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
set -e set -e
.github/assert-contributors.sh .github/assert-contributors.sh

View File

@@ -1,5 +1,11 @@
#!/bin/bash #!/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 ) SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cp "$SCRIPT_PATH/hooks/commit-msg.sh" "$SCRIPT_PATH/../.git/hooks/commit-msg" cp "$SCRIPT_PATH/hooks/commit-msg.sh" "$SCRIPT_PATH/../.git/hooks/commit-msg"

View File

@@ -1,4 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
set -e set -e
display_commit_message_error() { display_commit_message_error() {
@@ -24,7 +31,7 @@ lint_commit_message() {
display_commit_message_error "$1" 'Separate subject from body with a blank line' display_commit_message_error "$1" 'Separate subject from body with a blank line'
fi 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' display_commit_message_error "$1" 'Limit the subject line to 50 characters'
fi fi

View File

@@ -1,4 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
set -e set -e
# Disallow usages of functions that cause the program to exit in the library code # Disallow usages of functions that cause the program to exit in the library code

View File

@@ -1,14 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
set -e set -e
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) 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 find "$SCRIPT_PATH/.." -name "*.go" | while read fullpath; do
filename=$(basename -- "$fullpath") filename=$(basename -- "$fullpath")
if ! [[ $filename =~ $GO_REGEX ]]; then 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 exit 1
fi fi
done done

View File

@@ -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 language: go
go:
- 1.13
branches: branches:
only: only:
- master - master
cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
npm: true
yarn: true
env: env:
global: global:
- GO111MODULE=on - GO111MODULE=on
- GO_VERSION=1.13
- GOLANGCI_LINT_VERSION=1.19.1 - GOLANGCI_LINT_VERSION=1.19.1
cache:
directories:
- ${HOME}/.cache/go-build
- ${GOPATH}/pkg/mod
npm: true
yarn: true
lint_job: &lint_job
env: CACHE_NAME=lint
before_script:
- |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| bash -s - -b $GOPATH/bin v${GOLANGCI_LINT_VERSION}
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
- 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 \
-coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \
-tags quic \
-v -race ./...
after_success:
- 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/$(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: jobs:
include: include:
- name: Lint - <<: *lint_job
env: CACHE_NAME=lint name: Lint 1.13
before_script: go: 1.13
- go get -u github.com/sean-der/godox - <<: *test_job
- | name: Test 1.12
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \ go: 1.12
| bash -s - -b $GOPATH/bin v${GOLANGCI_LINT_VERSION} - <<: *test_job
install: true name: Test 1.13
script: go: 1.13
- bash .github/assert-contributors.sh - <<: *test_i386_job
- bash .github/lint-disallowed-functions-in-library.sh name: Test i386 1.12
- bash .github/lint-commit-message.sh env: GO_VERSION=1.12
- bash .github/lint-filename.sh - <<: *test_i386_job
- godox name: Test i386 1.13
- golangci-lint run --build-tags quic ./... env: GO_VERSION=1.13
- name: Go - <<: *test_wasm_job
env: CACHE_NAME=go name: Test WASM 1.13
install: true # Requires Go1.13 syscall/js
script: env: GO_VERSION=1.13
- coverpkgs=$(go list ./... | grep -v examples | paste -s -d ',')
- | notifications:
go test -tags quic \ email: false
-coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \
-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
language: bash
services: docker
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 ./...

View File

@@ -1,3 +1,9 @@
#
# DO NOT EDIT THIS FILE DIRECTLY
#
# It is automatically copied from https://github.com/pion/.goassets repository.
#
coverage: coverage:
status: status:
project: project: