Skip to content

Commit

Permalink
Add travis, codecov settings (#1)
Browse files Browse the repository at this point in the history
* Add travis, codecov settings

* Fix coverage.sh

* Fix typo

* Add codeclimate settings

* Fix some settings
  • Loading branch information
ww24 authored Mar 15, 2018
1 parent 0b08a92 commit 303e259
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins:
gofmt:
enabled: true
golint:
enabled: true
govet:
enabled: true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.*
!.gitignore

# go
vendor

# ci
!.travis.yml
!.codeclimate.yml
coverage.txt
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: go
sudo: false
go:
- "1.9.x"
- "1.10.x"
before_install:
- go get github.com/golang/dep/cmd/dep
install:
- $GOPATH/bin/dep ensure -v -vendor-only
script:
- ./coverage.sh
after_success:
- bash <(curl -s https://codecov.io/bash)
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

`image/jpeg` base pure go image utility.

[![GoDoc](https://godoc.org/github.com/go-oss/image?status.svg)](https://godoc.org/github.com/go-oss/image)
[![Build Status](https://travis-ci.org/go-oss/image.svg?branch=master)](https://travis-ci.org/go-oss/image)
[![codecov](https://codecov.io/gh/go-oss/image/branch/master/graph/badge.svg)](https://codecov.io/gh/go-oss/image)
[![Maintainability](https://api.codeclimate.com/v1/badges/1d34d57d8c26f502ce7d/maintainability)](https://codeclimate.com/github/go-oss/image/maintainability)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-oss/image)](https://goreportcard.com/report/github.com/go-oss/image)

## features
- Decode jpeg with quality value.
- Apply EXIF orientation to image pixels.

## compatibility
- Go 1.9+

## usage
To install `imageutil` package:

Expand All @@ -21,7 +30,6 @@ go get github.com/go-oss/image/jpeg

### example
```
reader := base64.NewDecoder(base64.StdEncoding, strings.NewReader(data))
img, err := imageutil.Decode(reader)
if err != nil {
log.Fatal(err)
Expand Down
12 changes: 12 additions & 0 deletions coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -xeu
echo "" > coverage.txt

for d in $(go list ./...); do
go test -race -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
2 changes: 1 addition & 1 deletion imageutil/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func Decode(file io.Reader) (*Image, error) {

// check EXIF and apply orientation
meta, decodeErr := exif.Decode(buff)
// if error occured, exif is invalid and discarded.
// if error occurred, exif is invalid and discarded.
if decodeErr == nil {
newImg, _ := applyOrientation(img.Image, meta)
if newImg != nil {
Expand Down

0 comments on commit 303e259

Please sign in to comment.