Skip to content

Commit

Permalink
Support files
Browse files Browse the repository at this point in the history
* Add golang dep for downloading test dependencies
* Create a makefile for supporting test and test-coverage
* Update documentation with new development features
* Update travis file to download and install golang dep
* Drop support for GO 1.5 to 1.7
  • Loading branch information
faabiosr committed Mar 14, 2018
1 parent d1a5f54 commit dadc60b
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.swo
cover.*
cache-dir/*
vendor
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
language: go

go:
- 1.5
- 1.6
- 1.7
- tip
- "1.8"
- "1.9"
- "1.10"
- master

services:
- memcached
- redis-server
- mongodb

env:
- DEP_VERSION="0.4.1"

before_install:
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi

install:
- dep ensure

script:
- $HOME/gopath/bin/goveralls -service=travis-ci
74 changes: 74 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/bradfitz/gomemcache"
revision = "1952afaa557dc08e8e0d89eafab110fb501c1a2b"

[[constraint]]
name = "github.com/pkg/errors"
version = "0.8.0"

[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.1"

[[constraint]]
branch = "v2"
name = "gopkg.in/mgo.v2"

[[constraint]]
name = "gopkg.in/redis.v4"
version = "4.2.4"

[prune]
go-tests = true
unused-packages = true
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: clean configure test test-coverage

.DEFAULT_GOAL := test

clean:
@rm -fR vendor/ cover.*
@docker-compose rm -s -f

configure:
@dep ensure -v
@docker-compose up -d

test:
@go test -v .

test-coverage: configure
@go test -coverprofile=cover.out -v .
@go tool cover -html=cover.out -o cover.html
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Simple interface around cache drivers

## Installation

Cachego requires Go 1.5 or later.
Cachego requires Go 1.8 or later.

```
go get github.com/fabiorphp/cachego
Expand Down Expand Up @@ -180,6 +180,28 @@ func main() {

Read the full documentation at [https://godoc.org/github.com/fabiorphp/cachego](https://godoc.org/github.com/fabiorphp/cachego).

## Development

### Requirements

- Install [docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/)
- Install [go dep](https://github.com/golang/dep)

### Run tests
```sh
// tests
$ make test

// test with coverage
$ make test-coverage

// clean-up
$ make clean

// configure (download dependencies and run docker containers)
$ make configure
```

## License

This project is released under the MIT licence. See [LICENSE](https://github.com/fabiorphp/cachego/blob/master/LICENSE) for more details.

0 comments on commit dadc60b

Please sign in to comment.