.travis.yml 4.4 KB

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