.travis.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #
  2. # DO NOT EDIT THIS FILE DIRECTLY
  3. #
  4. # It is automatically copied from https://github.com/pion/.goassets repository.
  5. # If this repository should have package specific CI config,
  6. # remove the repository name from .goassets/.github/workflows/assets-sync.yml.
  7. #
  8. dist: bionic
  9. language: go
  10. branches:
  11. only:
  12. - master
  13. env:
  14. global:
  15. - GO111MODULE=on
  16. - GOLANGCI_LINT_VERSION=1.19.1
  17. cache:
  18. directories:
  19. - ${HOME}/.cache/go-build
  20. - ${GOPATH}/pkg/mod
  21. npm: true
  22. yarn: true
  23. _lint_job: &lint_job
  24. env: CACHE_NAME=lint
  25. before_install:
  26. - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
  27. install: skip
  28. before_script:
  29. - |
  30. curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
  31. | bash -s - -b $GOPATH/bin v${GOLANGCI_LINT_VERSION}
  32. script:
  33. - bash .github/assert-contributors.sh
  34. - bash .github/lint-disallowed-functions-in-library.sh
  35. - bash .github/lint-commit-message.sh
  36. - bash .github/lint-filename.sh
  37. - golangci-lint run ./...
  38. _test_job: &test_job
  39. env: CACHE_NAME=test
  40. before_install:
  41. - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
  42. - go mod download
  43. install:
  44. - go build ./...
  45. script:
  46. - testpkgs=${TEST_PACKAGES:-$(go list ./... | grep -v examples)}
  47. - coverpkgs=$(echo "${testpkgs}" | paste -s -d ',')
  48. - |
  49. go test \
  50. -coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \
  51. ${TEST_EXTRA_ARGS:-} \
  52. -v -race ${testpkgs}
  53. - if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi
  54. after_success:
  55. - travis_retry bash <(curl -s https://codecov.io/bash) -c -F go
  56. _test_i386_job: &test_i386_job
  57. env: CACHE_NAME=test386
  58. services: docker
  59. before_install:
  60. - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
  61. script:
  62. - testpkgs=${TEST_PACKAGES:-$(go list ./... | grep -v examples)}
  63. - |
  64. docker run \
  65. -u $(id -u):$(id -g) \
  66. -e "GO111MODULE=on" \
  67. -e "CGO_ENABLED=0" \
  68. -v ${PWD}:/go/src/github.com/pion/$(basename ${PWD}) \
  69. -v ${HOME}/gopath/pkg/mod:/go/pkg/mod \
  70. -v ${HOME}/.cache/go-build:/.cache/go-build \
  71. -w /go/src/github.com/pion/$(basename ${PWD}) \
  72. -it i386/golang:${GO_VERSION}-alpine \
  73. /usr/local/go/bin/go test \
  74. ${TEST_EXTRA_ARGS:-} \
  75. -v ${testpkgs}
  76. _test_wasm_job: &test_wasm_job
  77. env: CACHE_NAME=wasm
  78. language: node_js
  79. node_js: 12
  80. before_install:
  81. - if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
  82. - if ${SKIP_WASM_TEST:-false}; then exit 0; fi
  83. install:
  84. # Manually download and install Go instead of using gimme.
  85. # It looks like gimme Go causes some errors on go-test for Wasm.
  86. - curl -sSfL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -C ~ -xzf -
  87. - export GOROOT=${HOME}/go
  88. - export PATH=${GOROOT}/bin:${PATH}
  89. - yarn install
  90. - export GO_JS_WASM_EXEC=${GO_JS_WASM_EXEC:-${GOROOT}/misc/wasm/go_js_wasm_exec}
  91. script:
  92. - testpkgs=${TEST_PACKAGES:-$(go list ./... | grep -v examples)}
  93. - coverpkgs=$(echo "${testpkgs}" | paste -s -d ',')
  94. - |
  95. GOOS=js GOARCH=wasm go test \
  96. -coverpkg=${coverpkgs} -coverprofile=cover.out -covermode=atomic \
  97. -exec="${GO_JS_WASM_EXEC}" \
  98. -v ${testpkgs}
  99. after_success:
  100. - travis_retry bash <(curl -s https://codecov.io/bash) -c -F wasm
  101. jobs:
  102. include:
  103. - <<: *lint_job
  104. name: Lint 1.14
  105. go: 1.14
  106. - <<: *test_job
  107. name: Test 1.13
  108. go: 1.13
  109. - <<: *test_job
  110. name: Test 1.14
  111. go: 1.14
  112. - <<: *test_i386_job
  113. name: Test i386 1.13
  114. env: GO_VERSION=1.13
  115. go: 1.14 # version for host environment used to go list
  116. - <<: *test_i386_job
  117. name: Test i386 1.14
  118. env: GO_VERSION=1.14
  119. go: 1.14 # version for host environment used to go list
  120. - <<: *test_wasm_job
  121. name: Test WASM 1.13
  122. env: GO_VERSION=1.13
  123. - <<: *test_wasm_job
  124. name: Test WASM 1.14
  125. env: GO_VERSION=1.14
  126. notifications:
  127. email: false