Skip to content

Commit

Permalink
Merge pull request #202 from bzz/go-11
Browse files Browse the repository at this point in the history
ci: add go 1.11
  • Loading branch information
bzz authored Feb 21, 2019
2 parents 3499750 + 3a6d42b commit e067e45
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 29 deletions.
60 changes: 33 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,43 @@ sudo: false
dist: trusty

language: go
go_import_path: gopkg.in/src-d/enry.v1

go:
- '1.11.x'
- '1.10.x'

go_import_path: gopkg.in/src-d/enry.v1
env:
global:
- GO_VERSION_FOR_JVM='1.11.x'
matrix:
- ONIGURUMA=0
- ONIGURUMA=1
matrix:
fast_finish: true

addons:
apt:
packages:
- libonig-dev

env:
global:
- GO_VERSION='1.10.x'
- ONIGURUMA=0

stages:
- name: test
- name: release
if: tag IS present
- name: publish
if: tag IS present

stage: test
install:
- if [[ -n "$ONIGURUMA" ]]; then tags="$tags oniguruma"; fi; go get -v -t --tags "$tags" ./...
script:
- make test-coverage
after_success:
- bash <(curl -s https://codecov.io/bash)

jobs:
include:
- &golang-unit-tests
name: 'golang unitTests'
stage: test
install:
- gimme version
- if [ "$ONIGURUMA" == "1" ]; then tags="$tags oniguruma"; fi; go get -v -t --tags "$tags" ./...
script:
- make test-coverage
after_success:
- bash <(curl -s https://codecov.io/bash)

- <<: *golang-unit-tests
name: 'golang unitTests, ONIGURUMA=1'
env: ONIGURUMA=1

- name: 'java unitTests'
- name: 'java unit-tests'
stage: test
language: scala
jdk: oraclejdk8
Expand All @@ -53,8 +50,7 @@ jobs:
- 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:
- gimme version
- 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
- echo $PWD; echo $GOPATH
- go get -v ./...
Expand All @@ -67,6 +63,7 @@ jobs:
- name: 'linux packages'
stage: release
install:
- go version
- go get -v -t ./...
script: make packages
deploy:
Expand All @@ -82,6 +79,7 @@ jobs:
- name: 'linux shared lib'
stage: release
install:
- go version
- go get -v -t ./...
script: make linux-shared
deploy:
Expand All @@ -102,6 +100,7 @@ jobs:
- 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
Expand All @@ -122,10 +121,17 @@ jobs:
stage: publish
language: scala
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:
- 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 get -v gopkg.in/src-d/enry.v1/...
- go get -v -t ./...
before_script:
- cd java
- make
Expand Down
15 changes: 13 additions & 2 deletions internal/code-generator/generator/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package generator

import (
"flag"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -283,6 +283,17 @@ func (s *GeneratorTestSuite) TestGenerationFiles() {
assert.NoError(s.T(), err)
out, err := ioutil.ReadFile(outPath.Name())
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), " ")
}

0 comments on commit e067e45

Please sign in to comment.