Update .travis.yml (#114)

* Update .travis.yml

* Add build.sh for examples

* Update goimports

* update travis.yml
This commit is contained in:
Masashi SHIBATA 2018-12-09 20:42:33 +09:00 committed by GitHub
parent b6d2b439b9
commit b47e013727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 46 additions and 24 deletions

View File

@ -11,22 +11,35 @@ os:
- windows
install:
- make setup
- go get -u golang.org/x/lint/golint
- go get -u golang.org/x/tools/cmd/goimports
- go get -u github.com/golang/dep/cmd/dep
- dep ensure
stages:
- lint
- examples
- test
jobs:
include:
- stage: Lint
- stage: lint
script:
- diff <(goimports -d $(find . -type f -name '*.go' -not -path "./vendor/*")) <(echo -n "")
- make lint
go: "1.11.x"
os: osx
- stage: examples
script:
- ./_example/build.sh
go: "1.11.x"
os: osx
script:
- make test
- make build
- go test -race ./...
matrix:
fast_finish: true
allow_failures:
- go: tip
- os: windows

View File

@ -1,5 +1,7 @@
.DEFAULT_GOAL := help
SOURCES := $(shell find . -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print)
.PHONY: setup
setup: ## Setup for required tools.
go get -u golang.org/x/lint/golint
@ -9,8 +11,8 @@ setup: ## Setup for required tools.
dep ensure
.PHONY: fmt
fmt: ## Formatting source codes.
@goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*")
fmt: $(SOURCES) ## Formatting source codes.
@goimports -w $^
.PHONY: lint
lint: ## Run golint and go vet.
@ -29,11 +31,7 @@ cover: ## Run the tests.
.PHONY: build
build: ## Build example command lines.
go build -o bin/exec-command ./_example/exec-command/main.go
go build -o bin/http-prompt ./_example/http-prompt/main.go
go build -o bin/live-prefix ./_example/live-prefix/main.go
go build -o bin/simple-echo ./_example/simple-echo/main.go
go build -o bin/simple-echo-cjk-cyrillic ./_example/simple-echo/cjk-cyrillic/main.go
./_example/build.sh
.PHONY: help
help: ## Show help text

11
_example/build.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
DIR=$(cd $(dirname $0); pwd)
BIN_DIR=$(cd $(dirname $(dirname $0)); pwd)/bin
mkdir -p ${BIN_DIR}
go build -o ${BIN_DIR}/exec-command ${DIR}/exec-command/main.go
go build -o ${BIN_DIR}/http-prompt ${DIR}/http-prompt/main.go
go build -o ${BIN_DIR}/live-prefix ${DIR}/live-prefix/main.go
go build -o ${BIN_DIR}/simple-echo ${DIR}/simple-echo/main.go
go build -o ${BIN_DIR}/simple-echo-cjk-cyrillic ${DIR}/simple-echo/cjk-cyrillic/main.go

View File

@ -4,7 +4,7 @@ import (
"os"
"os/exec"
"github.com/c-bata/go-prompt"
prompt "github.com/c-bata/go-prompt"
)
func executor(t string) {

View File

@ -10,7 +10,7 @@ import (
"path"
"strings"
"github.com/c-bata/go-prompt"
prompt "github.com/c-bata/go-prompt"
)
type RequestContext struct {

View File

@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/c-bata/go-prompt"
prompt "github.com/c-bata/go-prompt"
)
var LivePrefixState struct {

View File

@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/c-bata/go-prompt"
prompt "github.com/c-bata/go-prompt"
)
func executor(in string) {

View File

@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/c-bata/go-prompt"
prompt "github.com/c-bata/go-prompt"
)
func completer(in prompt.Document) []prompt.Suggest {

View File

@ -5,7 +5,7 @@ import (
"os"
"strings"
"github.com/c-bata/go-prompt"
prompt "github.com/c-bata/go-prompt"
"github.com/c-bata/go-prompt/completer"
)

View File

@ -4,7 +4,7 @@ import (
"fmt"
"syscall"
"github.com/c-bata/go-prompt"
prompt "github.com/c-bata/go-prompt"
"github.com/pkg/term/termios"
)

View File

@ -8,7 +8,7 @@ import (
"path/filepath"
"runtime"
"github.com/c-bata/go-prompt"
prompt "github.com/c-bata/go-prompt"
)
var (

View File

@ -4,7 +4,7 @@ import (
"log"
"strings"
"github.com/mattn/go-runewidth"
runewidth "github.com/mattn/go-runewidth"
)
const (

View File

@ -5,7 +5,7 @@ import (
"strings"
"unicode/utf8"
"github.com/mattn/go-runewidth"
runewidth "github.com/mattn/go-runewidth"
)
// Document has text displayed in terminal and cursor position.

View File

@ -9,7 +9,7 @@ import (
"unicode/utf8"
"unsafe"
"github.com/mattn/go-tty"
tty "github.com/mattn/go-tty"
)
const maxReadBytes = 1024

View File

@ -5,7 +5,7 @@ package prompt
import (
"io"
"github.com/mattn/go-colorable"
colorable "github.com/mattn/go-colorable"
)
// WindowsWriter is a ConsoleWriter implementation for Win32 console.

View File

@ -3,7 +3,7 @@ package prompt
import (
"runtime"
"github.com/mattn/go-runewidth"
runewidth "github.com/mattn/go-runewidth"
)
// Render to render prompt information from state of Buffer.