Skip to content
This repository was archived by the owner on Dec 15, 2020. It is now read-only.

Commit 13e1400

Browse files
author
Filip Haftek
authored
switched to go 1.9.2 + tests on docker (#20)
* switched to go 1.9.2 + tests on docker * Added new line * added .travis.yml * Addons with docker-ce for travis
1 parent fb2ba2c commit 13e1400

File tree

6 files changed

+47
-24
lines changed

6 files changed

+47
-24
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sudo: required
2+
3+
services:
4+
- docker
5+
6+
addons:
7+
apt:
8+
packages:
9+
- docker-ce
10+
11+
script:
12+
- docker-compose run --rm tests

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.8.3-alpine AS golang-build
1+
FROM golang:1.9.2-alpine3.6 AS golang-build
22
RUN mkdir -p /go/src/github.com/AirHelp/zendesk-mock
33
WORKDIR /go/src/github.com/AirHelp/zendesk-mock
44
COPY . .

Dockerfile-test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM golang:1.9.2-alpine3.6 AS golang-build
2+
RUN mkdir -p /go/src/github.com/AirHelp/zendesk-mock

Makefile

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
1-
TEST?=$$(go list ./... | grep -v '/vendor/')
2-
GOFMT_FILES?=$$(find . -type f -name '*.go' | grep -v vendor)
3-
41
build:
5-
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o zendesk-mock .
6-
7-
release: build
8-
docker build -t airhelp/zendesk-mock -f Dockerfile .
2+
docker build -t airhelp/zendesk-mock .
93

10-
push: release
4+
push: build
115
docker push airhelp/zendesk-mock
126

13-
fmt:
14-
@echo 'run Go autoformat'
15-
@gofmt -w $(GOFMT_FILES)
16-
17-
# vet runs the Go source code static analysis tool `vet` to find
18-
# any common errors.
19-
vet:
20-
@echo 'run the code static analysis tool'
21-
@go tool vet -all $$(ls -d */ | grep -v vendor)
22-
23-
test: fmt vet
24-
@echo 'run the unit tests'
25-
@go test -cover $(TEST)
7+
tests:
8+
docker-compose run --rm tests
269

2710
dev:
2811
go build

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cd $GOPATH/src/github.com/AirHelp/zendesk-mock
99

1010
## Build
1111
```bash
12-
make release
12+
make build
1313
```
1414

1515
## Run locally on docker
@@ -25,5 +25,5 @@ make push
2525
## Execute tests
2626

2727
```
28-
make test
28+
make tests
2929
```

docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '3.1'
2+
services:
3+
tests:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile-test
7+
command: go test ./...
8+
volumes:
9+
- ./:/go/src/github.com/AirHelp/zendesk-mock
10+
depends_on:
11+
- fmt
12+
- vet
13+
vet:
14+
build:
15+
context: .
16+
dockerfile: Dockerfile-test
17+
command: go vet -v ./...
18+
volumes:
19+
- .:/go/src/github.com/AirHelp/zendesk-mock
20+
fmt:
21+
build:
22+
context: .
23+
dockerfile: Dockerfile-test
24+
command: gofmt ./...
25+
volumes:
26+
- .:/go/src/github.com/AirHelp/zendesk-mock

0 commit comments

Comments
 (0)