From a5a5916a3463362559822145f95e4f27c50d3994 Mon Sep 17 00:00:00 2001 From: Navi Arimeka Date: Sat, 16 Nov 2019 16:14:27 +0300 Subject: [PATCH] Integrate Travis-CI --- .travis.yml | 48 +++++++++++++++++++++++++++++++++++++++++ README.md | 4 ++++ argument.go | 3 +-- examples/resize/main.go | 1 + operation.go | 1 + operation_test.go | 13 ----------- scripts/linter.sh | 3 +++ scripts/test.sh | 3 --- value.go | 1 + 9 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..039f29f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,48 @@ +language: go + +os: linux +dist: xenial + +go: + - 1.11.x + - 1.12.x + - 1.x + +cache: + apt: + +addons: + apt: + packages: + - gobject-introspection + - gtk-doc-tools + - libcfitsio3-dev + - libfftw3-dev + - libgif-dev + - libgs-dev + - libgsf-1-dev + - libmatio-dev + - libopenslide-dev + - liborc-0.4-dev + - libpango1.0-dev + - libpoppler-glib-dev + - libwebp-dev + - libvips-dev + +before_install: + - pkg-config --modversion vips + - go get -u github.com/mattn/goveralls + +install: + - go get golang.org/x/lint/golint + - go get -v github.com/go-lintpack/lintpack/... + - go get -v github.com/go-critic/go-critic/... + - go get -v github.com/fzipp/gocyclo + - go get -v github.com/gordonklaus/ineffassign + - lintpack build -o $GOPATH/bin/gocritic -linter.name='gocritic' github.com/go-critic/go-critic/checkers + +script: + - make test + +after_success: + - goveralls -coverprofile=./coverage/cover.out -service=travis-ci diff --git a/README.md b/README.md index cd9f5b0..ca68053 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # IMGVips +[![Build Status](https://travis-ci.org/Arimeka/imgvips.svg?branch=master)](https://travis-ci.org/Arimeka/imgvips) +[![Coverage Status](https://coveralls.io/repos/github/Arimeka/imgvips/badge.svg?branch=master)](https://coveralls.io/github/Arimeka/imgvips?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/Arimeka/imgvips)](https://goreportcard.com/report/github.com/Arimeka/imgvips) +[![GoDoc](https://godoc.org/github.com/Arimeka/imgvips?status.svg)](https://godoc.org/github.com/Arimeka/imgvips) Low-level bindings for [libvips](https://github.com/libvips/libvips). For better shooting to the leg. diff --git a/argument.go b/argument.go index a55ab1d..f8e9548 100644 --- a/argument.go +++ b/argument.go @@ -1,8 +1,7 @@ package imgvips /* -#cgo pkg-config: vips -#include "vips/vips.h" +#include "stdlib.h" */ import "C" diff --git a/examples/resize/main.go b/examples/resize/main.go index 503b860..17c941a 100644 --- a/examples/resize/main.go +++ b/examples/resize/main.go @@ -2,6 +2,7 @@ package main /* #cgo pkg-config: vips +#include "stdlib.h" #include "vips/vips.h" */ import "C" diff --git a/operation.go b/operation.go index 5dea3ba..ebf1756 100644 --- a/operation.go +++ b/operation.go @@ -2,6 +2,7 @@ package imgvips /* #cgo pkg-config: vips +#include "stdlib.h" #include "vips/vips.h" */ import "C" diff --git a/operation_test.go b/operation_test.go index e5c94fc..f64d916 100644 --- a/operation_test.go +++ b/operation_test.go @@ -173,13 +173,6 @@ func BenchmarkOperation_Exec(b *testing.B) { b.Fatalf("Unexpected error %v", err) } - image, ok = resizeOut.Image() - if !ok { - op.Free() - resizeOp.Free() - b.Fatalf("Expected *C.VipsImage in out") - } - saveOp, err := imgvips.NewOperation("pngsave") if err != nil { op.Free() @@ -250,12 +243,6 @@ func ExampleOperation_Exec() { return } - image, ok = resizeOut.Image() - if !ok { - log.Println(errors.New("resizeOut is not *C.VipsImage")) - return - } - saveOp, err := imgvips.NewOperation("webpsave") if err != nil { log.Println(err) diff --git a/scripts/linter.sh b/scripts/linter.sh index 275c6f9..793fc95 100755 --- a/scripts/linter.sh +++ b/scripts/linter.sh @@ -10,6 +10,9 @@ echo echo "==> Running gocritic <==" gocritic check ./... || exit_code=1 echo +echo "==> Running ineffassign <==" +ineffassign ./* || exit_code=1 +echo echo "==> Running gocyclo <==" gocyclo -over 10 . || exit_code=1 diff --git a/scripts/test.sh b/scripts/test.sh index e04cdda..f9a7227 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -2,9 +2,6 @@ echo echo "==> Running go test <==" -if [ $(uname) == "Linux" ]; then - go test -msan ./... || exit_code=1 -fi go test -cover -race -coverprofile=cover.out -outputdir=coverage ./... || exit_code=1 echo echo "==> Running coverage <==" diff --git a/value.go b/value.go index 507d4bb..f2f28b5 100644 --- a/value.go +++ b/value.go @@ -2,6 +2,7 @@ package imgvips /* #cgo pkg-config: vips +#include "stdlib.h" #include "vips/vips.h" */ import "C"