-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dockerized for contribution and add automated testing with Trav…
…isCI (#14) * chore: dockerized and use dep to manage dependencies * fix: add 'Source' option to Config * rebase mixed code * chore: Use golang:alpine image to shrink final size * feat: Add travis.yml * chore: Use native go environment * fix: Add mongodb for travis * fix: switch back to docker-compose for travis * Update readme for #11 * chore: Add TravisCI badge
- Loading branch information
Showing
10 changed files
with
157 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,12 @@ _testmain.go | |
*.prof | ||
|
||
# Intellij | ||
.idea | ||
.idea | ||
|
||
# godep | ||
vendor | ||
|
||
# data storage | ||
.data | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
env: | ||
- DOCKER_COMPOSE_VERSION=1.18.0 | ||
|
||
before_install: | ||
- sudo rm /usr/local/bin/docker-compose | ||
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose | ||
- chmod +x docker-compose | ||
- sudo mv docker-compose /usr/local/bin | ||
|
||
script: | ||
- make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:alpine | ||
|
||
ENV APP_DIR $GOPATH/src/mongodm | ||
|
||
RUN apk add --update --no-cache git && \ | ||
mkdir -p $APP_DIR && \ | ||
go get -u github.com/golang/dep/cmd/dep | ||
|
||
ADD . $APP_DIR | ||
|
||
WORKDIR $APP_DIR |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# Gopkg.toml example | ||
# | ||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | ||
# 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" | ||
|
||
|
||
[[constraint]] | ||
branch = "v2" | ||
name = "gopkg.in/mgo.v2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
IMAGE = mongodm | ||
APP_DIR = /go/src/mongodm | ||
RUN = docker run -it --rm -v $(PWD):$(APP_DIR) $(IMAGE) | ||
ARGS = $(filter-out $@,$(MAKECMDGOALS)) | ||
|
||
test: | ||
docker-compose run test | ||
|
||
dep: | ||
echo $(ARGS) | ||
$(RUN) dep $(ARGS) | ||
|
||
%: | ||
@: | ||
|
||
.PHONY: | ||
test dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
version: '3' | ||
services: | ||
test: | ||
depends_on: | ||
- mongodb | ||
build: | ||
context: . | ||
image: mongodm | ||
volumes: | ||
- "$PWD:/go/src/mongodm" | ||
command: sh -c "dep ensure -v && go test" | ||
|
||
mongodb: | ||
image: mongo | ||
container_name: mongo | ||
ports: | ||
- "27017:27017" | ||
volumes: | ||
- "$PWD/.data:/data/db" | ||
command: mongod | ||
environment: | ||
- MONGO_INITDB_ROOT_USERNAME=admin | ||
- MONGO_INITDB_ROOT_PASSWORD=admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters