tartrazine/.travis.yml
Alexander Bezzubov 5fab94b5b9
ci: disable cgo by default
With go1.11 `go test` in GOPATH mode somehow
seems to depend on GCC. See https://github.com/golang/go/issues/28065

This change only enables cgo for CI profiles that
need it. Those are the ones that seem to fail
on TravisCI now, presumably due to some compiler
version missmatch.

That is a workaround and does not happen in GO11MODULE mode.

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-04-11 15:10:43 +02:00

151 lines
4.9 KiB
YAML

sudo: false
dist: trusty
language: go
go_import_path: gopkg.in/src-d/enry.v1
go:
- '1.11.6'
- '1.12.1'
env:
global:
- GO_VERSION_FOR_JVM='1.11.1'
- CGO_ENABLED=0
matrix:
- ONIGURUMA=0
- ONIGURUMA=1
matrix:
fast_finish: true
addons:
apt:
packages:
- libonig-dev
stages:
- name: test
- name: release
if: tag IS present
- name: publish
if: tag IS present
stage: test
install:
- if [[ "${ONIGURUMA}" -gt 0 ]]; then export tags="${tags} oniguruma"; CGO_ENABLED=1; fi; go get -v -t -tags "${tags}" ./...
script:
- make test-coverage
after_success:
- bash <(curl -s https://codecov.io/bash)
jobs:
include:
- name: 'java unit-tests'
stage: test
language: scala
jdk: oraclejdk8
before_install:
- CGO_ENABLED=1
# mimics exact behavior of 'go_import_path' for non-go build image
- export GOPATH=${TRAVIS_HOME}/gopath
- mkdir -p ${GOPATH}/src/gopkg.in/src-d/enry.v1
- tar -Pczf ${TRAVIS_TMPDIR}/src_archive.tar.gz -C ${TRAVIS_BUILD_DIR} . && tar -Pxzf ${TRAVIS_TMPDIR}/src_archive.tar.gz -C ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
- export TRAVIS_BUILD_DIR=${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
- cd ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
install:
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION_FOR_JVM bash)"
- go version
- echo $PWD; echo $GOPATH
- go get -v ./...
before_script:
- cd java
- make
script:
- make test
- name: 'linux packages'
stage: release
install:
- go version
- go get -v -t ./...
script: make packages
deploy:
provider: releases
api_key:
secure: $GITHUB_TOKEN
file_glob: true
file: build/*.tar.gz
skip_cleanup: true
on:
tags: true
- name: 'linux shared lib'
stage: release
install:
- go version
- go get -v -t ./...
script: make linux-shared
deploy:
provider: releases
api_key:
secure: $GITHUB_TOKEN
file:
- ./.shared/linux-x86-64/libenry.so
skip_cleanup: true
on:
tags: true
- name: 'macOS shared lib'
stage: release
sudo: true
env:
- OSXCROSS_PACKAGE="osxcross_3034f7149716d815bc473d0a7b35d17e4cf175aa.tar.gz"
- OSXCROSS_URL="https://github.com/bblfsh/client-scala/releases/download/v1.5.2/${OSXCROSS_PACKAGE}"
- PATH="/$HOME/osxcross/bin:$PATH"
install:
- go version
- go get -v -t ./...
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends clang g++ gcc gcc-multilib libc6-dev libc6-dev-i386 mingw-w64 patch xz-utils
- cd ${HOME}
- curl -sfSL ${OSXCROSS_URL} | tar -C ${HOME} -xzf -
- cd $GOPATH/src/gopkg.in/src-d/enry.v1
script: make darwin-shared
deploy:
provider: releases
api_key:
secure: $GITHUB_TOKEN
file: ./.shared/darwin/libenry.dylib
skip_cleanup: true
on:
tags: true
- name: 'java: publish to maven'
stage: publish
language: scala
jdk: oraclejdk8
before_install:
- CGO_ENABLED=1
# mimics exact behavior of 'go_import_path' for non-go build image
- export GOPATH=${TRAVIS_HOME}/gopath
- mkdir -p ${GOPATH}/src/gopkg.in/src-d/enry.v1
- tar -Pczf ${TRAVIS_TMPDIR}/src_archive.tar.gz -C ${TRAVIS_BUILD_DIR} . && tar -Pxzf ${TRAVIS_TMPDIR}/src_archive.tar.gz -C ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
- export TRAVIS_BUILD_DIR=${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
- cd ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
install:
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION_FOR_JVM bash)"
- go version
- go get -v -t ./...
before_script:
- cd java
- make
- curl -o ./shared/linux-x86-64/libenry.so -sfL "https://github.com/$TRAVIS_REPO_SLUG/releases/download/$TRAVIS_TAG/libenry.so" || travis_terminate 1
- mkdir -p ./shared/darwin
- curl -o ./shared/darwin/libenry.dylib -sfL "https://github.com/$TRAVIS_REPO_SLUG/releases/download/$TRAVIS_TAG/libenry.dylib" || travis_terminate 1
- openssl aes-256-cbc -K $encrypted_a0e1c69dbbc7_key -iv $encrypted_a0e1c69dbbc7_iv -in key.asc.enc -out key.asc -d
- gpg --no-default-keyring --primary-keyring ./project/.gnupg/pubring.gpg --secret-keyring ./project/.gnupg/secring.gpg --keyring ./project/.gnupg/pubring.gpg --fingerprint --import key.asc
script:
- make test # ensure the shared objects are functional
- ./sbt publishLocal
- ./sbt publishSigned
- ./sbt sonatypeRelease