Merge pull request #202 from bzz/go-11

ci: add go 1.11
This commit is contained in:
Alexander 2019-02-21 11:49:23 +01:00 committed by GitHub
commit e067e45044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 30 deletions

View File

@ -2,21 +2,25 @@ sudo: false
dist: trusty dist: trusty
language: go language: go
go:
- '1.10.x'
go_import_path: gopkg.in/src-d/enry.v1 go_import_path: gopkg.in/src-d/enry.v1
go:
- '1.11.x'
- '1.10.x'
env:
global:
- GO_VERSION_FOR_JVM='1.11.x'
matrix:
- ONIGURUMA=0
- ONIGURUMA=1
matrix:
fast_finish: true
addons: addons:
apt: apt:
packages: packages:
- libonig-dev - libonig-dev
env:
global:
- GO_VERSION='1.10.x'
- ONIGURUMA=0
stages: stages:
- name: test - name: test
- name: release - name: release
@ -24,24 +28,17 @@ stages:
- name: publish - name: publish
if: tag IS present if: tag IS present
jobs: stage: test
include: install:
- &golang-unit-tests - if [[ -n "$ONIGURUMA" ]]; then tags="$tags oniguruma"; fi; go get -v -t --tags "$tags" ./...
name: 'golang unitTests' script:
stage: test
install:
- gimme version
- if [ "$ONIGURUMA" == "1" ]; then tags="$tags oniguruma"; fi; go get -v -t --tags "$tags" ./...
script:
- make test-coverage - make test-coverage
after_success: after_success:
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)
- <<: *golang-unit-tests jobs:
name: 'golang unitTests, ONIGURUMA=1' include:
env: ONIGURUMA=1 - name: 'java unit-tests'
- name: 'java unitTests'
stage: test stage: test
language: scala language: scala
jdk: oraclejdk8 jdk: oraclejdk8
@ -53,8 +50,7 @@ jobs:
- export TRAVIS_BUILD_DIR=${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 - cd ${TRAVIS_HOME}/gopath/src/gopkg.in/src-d/enry.v1
install: install:
- gimme version - eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION_FOR_JVM bash)"
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION bash)"
- go version - go version
- echo $PWD; echo $GOPATH - echo $PWD; echo $GOPATH
- go get -v ./... - go get -v ./...
@ -67,6 +63,7 @@ jobs:
- name: 'linux packages' - name: 'linux packages'
stage: release stage: release
install: install:
- go version
- go get -v -t ./... - go get -v -t ./...
script: make packages script: make packages
deploy: deploy:
@ -82,6 +79,7 @@ jobs:
- name: 'linux shared lib' - name: 'linux shared lib'
stage: release stage: release
install: install:
- go version
- go get -v -t ./... - go get -v -t ./...
script: make linux-shared script: make linux-shared
deploy: deploy:
@ -102,6 +100,7 @@ jobs:
- OSXCROSS_URL="https://github.com/bblfsh/client-scala/releases/download/v1.5.2/${OSXCROSS_PACKAGE}" - OSXCROSS_URL="https://github.com/bblfsh/client-scala/releases/download/v1.5.2/${OSXCROSS_PACKAGE}"
- PATH="/$HOME/osxcross/bin:$PATH" - PATH="/$HOME/osxcross/bin:$PATH"
install: install:
- go version
- go get -v -t ./... - go get -v -t ./...
- sudo apt-get update - 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 - sudo apt-get install -y --no-install-recommends clang g++ gcc gcc-multilib libc6-dev libc6-dev-i386 mingw-w64 patch xz-utils
@ -122,10 +121,17 @@ jobs:
stage: publish stage: publish
language: scala language: scala
jdk: oraclejdk8 jdk: oraclejdk8
before_install:
# 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: install:
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION bash)" - eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=$GO_VERSION_FOR_JVM bash)"
- go version - go version
- go get -v gopkg.in/src-d/enry.v1/... - go get -v -t ./...
before_script: before_script:
- cd java - cd java
- make - make

View File

@ -2,11 +2,11 @@ package generator
import ( import (
"flag" "flag"
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"strings"
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -283,6 +283,17 @@ func (s *GeneratorTestSuite) TestGenerationFiles() {
assert.NoError(s.T(), err) assert.NoError(s.T(), err)
out, err := ioutil.ReadFile(outPath.Name()) out, err := ioutil.ReadFile(outPath.Name())
assert.NoError(s.T(), err) assert.NoError(s.T(), err)
assert.EqualValues(s.T(), gold, out, fmt.Sprintf("%v: %v, expected: %v", test.name, string(out), string(gold)))
expected := normalizeSpaces(string(gold))
actual := normalizeSpaces(string(out))
assert.Equal(s.T(), expected, actual, "Test %s", test.name)
} }
} }
// normalizeSpaces returns a copy of str with whitespaces normalized.
// We use this to compare generated source as gofmt format may change.
// E.g for changes between Go 1.10 and 1.11 see
// https://go-review.googlesource.com/c/go/+/122295/
func normalizeSpaces(str string) string {
return strings.Join(strings.Fields(str), " ")
}