.travis.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. dist: xenial
  2. sudo: required
  3. git:
  4. depth: 9999999
  5. language: go
  6. go:
  7. - 1.11.x
  8. - 1.12.x
  9. - 1.13.x
  10. services:
  11. - docker
  12. cache:
  13. directories:
  14. - $HOME/.cache/pip
  15. - $HOME/vendor
  16. matrix:
  17. fast_finish: true
  18. stages:
  19. - test
  20. - name: deploy
  21. # require any tag name to deploy
  22. if: tag =~ .*
  23. env:
  24. - PROTOC_VERSION=3.6.0 TENSORFLOW_VERSION=1.11.0 GOPATH=
  25. before_install:
  26. - wget -O protoc.zip https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip
  27. - unzip -d ~/.local protoc.zip && rm protoc.zip
  28. - go get -v golang.org/x/lint/golint
  29. - (wget -O - https://bootstrap.pypa.io/get-pip.py || wget -O - https://raw.githubusercontent.com/pypa/get-pip/master/get-pip.py) | sudo python3 - pip==18.1
  30. - export PATH=~/usr/bin:.:$PATH
  31. - make --version
  32. - pip3 --version
  33. - sudo pip3 install cython
  34. - sudo pip3 install tensorflow flake8 ./python
  35. - docker run -d --privileged -p 9432:9432 --name bblfshd bblfsh/bblfshd
  36. - docker exec -it bblfshd bblfshctl driver install python bblfsh/python-driver:latest
  37. - docker exec -it bblfshd bblfshctl driver install go bblfsh/go-driver:latest
  38. - docker exec -it bblfshd bblfshctl driver install java bblfsh/java-driver:latest
  39. - curl -L "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-$(go env GOOS)-x86_64-$TENSORFLOW_VERSION.tar.gz" | sudo tar -C /usr/local -xz
  40. - sudo ldconfig
  41. install:
  42. - git clean -xfd
  43. - go env
  44. - travis_retry make TAGS=tensorflow
  45. script:
  46. - set -e
  47. - if [ $TRAVIS_GO_VERSION != "1.10.x" ]; then test -z "$(gofmt -s -l . | grep -v vendor/)"; fi
  48. - export GO111MODULE=on
  49. - go vet -tags tensorflow ./...
  50. - golint -set_exit_status $(go list ./... | grep -v /vendor/)
  51. - cd python && flake8 && cd ..
  52. - go test -coverpkg=all -v -coverprofile=coverage.txt -covermode=count gopkg.in/src-d/hercules.v10/... && sed -i '/cmd\/hercules\|core.go/d' coverage.txt
  53. - # race checks increase the elapsed time by 10 minutes, we run them only in AppVeyor
  54. - hercules version
  55. - hercules --burndown --couples --devs --quiet --pb https://github.com/src-d/hercules > 1.pb
  56. - cp 1.pb 2.pb
  57. - hercules combine 1.pb 2.pb > 12.pb
  58. - (hercules generate-plugin -n MyPlug -o myplug && cd myplug && GOFLAGS="-tags=tensorflow" make)
  59. - hercules --plugin myplug/my_plug.so --help | grep my-plug
  60. - (cd contrib/_plugin_example && GOBIN=../.. make)
  61. - hercules --burndown --burndown-files --burndown-people --couples --devs --quiet https://github.com/src-d/hercules | labours -m all -o out --backend Agg --disable-projector
  62. - hercules --burndown --burndown-files --burndown-people --couples --devs --quiet --pb https://github.com/src-d/hercules | labours -f pb -m all -o out --backend Agg --disable-projector
  63. - # hercules --sentiment --quiet --languages Python https://github.com/src-d/hercules > /dev/null
  64. - set +e
  65. - if [ $TRAVIS_GO_VERSION == "1.11.x" ]; then bash <(curl -s https://codecov.io/bash); fi
  66. jobs:
  67. include:
  68. - stage: test
  69. language: generic
  70. env: DOCKER_BUILD=1
  71. before_install: skip
  72. install: skip
  73. script:
  74. - docker build -t srcd/hercules .
  75. - docker run --rm srcd/hercules hercules --help
  76. - docker run --rm srcd/hercules labours --help
  77. - stage: deploy
  78. os: osx
  79. osx_image: xcode9.3
  80. go: 1.12.x
  81. before_install:
  82. - wget -O protoc.zip https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-osx-x86_64.zip
  83. - unzip -d ~/.local protoc.zip && rm protoc.zip
  84. - export PATH=.:$PATH
  85. after_success:
  86. - gzip -S .darwin_amd64.gz hercules
  87. script: skip
  88. install:
  89. - travis_retry make
  90. deploy:
  91. provider: releases
  92. api_key:
  93. secure: $GITHUB_TOKEN
  94. file: "hercules.darwin_amd64.gz"
  95. skip_cleanup: true
  96. on:
  97. tags: true
  98. - stage: deploy
  99. os: linux
  100. go: 1.13.x
  101. before_install:
  102. - wget -O protoc.zip https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip
  103. - unzip -d ~/.local protoc.zip && rm protoc.zip
  104. - export PATH=.:$PATH
  105. - (wget -O - https://bootstrap.pypa.io/get-pip.py || wget -O - https://raw.githubusercontent.com/pypa/get-pip/master/get-pip.py) | sudo python3 - pip==18.1
  106. - sudo pip3 install twine pyopenssl
  107. script:
  108. - test v$(python3 python/setup.py --version) == $TRAVIS_TAG
  109. install:
  110. - set -e
  111. - travis_retry make
  112. - cd python
  113. - python3 setup.py bdist_wheel
  114. - cp dist/*py3-none-any* ..
  115. - cd ..
  116. after_success:
  117. - gzip -S .linux_amd64.gz hercules
  118. deploy:
  119. - provider: releases
  120. api_key:
  121. secure: $GITHUB_TOKEN
  122. file: "hercules.linux_amd64.gz"
  123. skip_cleanup: true
  124. on:
  125. tags: true
  126. - provider: script
  127. script: twine upload *py3-none-any* -u $PYPI_LOGIN -p $PYPI_PASS
  128. skip_cleanup: true
  129. on:
  130. tags: true
  131. notifications:
  132. email: false