Skip to content

Commit 56a709a

Browse files
authored
Merge pull request #6 from jancajthaml/feature/ci-improvements
better Makefile, shielded badges, coveralls integration
2 parents bd1c0bb + 37cfbaa commit 56a709a

File tree

7 files changed

+33
-29
lines changed

7 files changed

+33
-29
lines changed

.circleci/config.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ jobs:
1313
name: Sync dependencies
1414
command: |
1515
go get -u github.com/kardianos/govendor
16+
go get -u golang.org/x/tools/cmd/cover
17+
go get -u github.com/mattn/goveralls
1618
govendor sync -v
1719
1820
- run:
1921
name: Run tests
2022
command: |
2123
cd /go/src/jancajthaml/src/datadog-mock
22-
go test -v ./...
24+
: > /go/src/jancajthaml/coverage.txt
25+
go test -v -cover -race -coverprofile=/go/src/jancajthaml/coverage.txt -covermode=atomic ./...
26+
goveralls -coverprofile=/go/src/jancajthaml/coverage.txt -service=circle-ci -repotoken=$COVERALLS_TOKEN
2327
2428
- run:
2529
name: Build server
@@ -43,19 +47,18 @@ jobs:
4347
at: /go/src/github.com/jancajthaml
4448

4549
- checkout
46-
4750
- setup_remote_docker
4851

4952
- run:
5053
name: Build application Docker image
5154
command: |
5255
cp -r /go/src/github.com/jancajthaml/target /app/target
53-
docker build -t bundle .
54-
55-
- run:
56-
name: List images
57-
command: |
58-
docker images
56+
docker build \
57+
--build-arg VERSION=$(cat VERSION) \
58+
--build-arg VCS_REF=${CIRCLE_SHA1} \
59+
--build-arg VCS_URL=$(git config --get remote.origin.url) \
60+
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
61+
-t bundle .
5962
6063
- deploy:
6164
name: Push image to DockerHUB

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ FROM scratch
1616

1717
MAINTAINER Jan Cajthaml <[email protected]>
1818

19+
ARG BUILD_DATE
20+
ARG VCS_REF
21+
ARG VERSION
22+
LABEL org.label-schema.build-date=$BUILD_DATE \
23+
org.label-schema.name="datadog-mock" \
24+
org.label-schema.description="DataDog mock service Edit" \
25+
org.label-schema.vcs-ref=$VCS_REF \
26+
org.label-schema.vcs-url="https://github.com/jancajthaml/datadog-mock" \
27+
org.label-schema.vendor="Jan Cajthaml" \
28+
org.label-schema.version=$VERSION \
29+
org.label-schema.schema-version="1.0"
30+
1931
COPY target/datadog_mock /datadog_mock
2032

2133
EXPOSE 8125/UDP

ISSUE_TEMPLATE.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
### Step 1: Are you in the right place?
2-
3-
* For issues or feature requests related to the code **in this repository** file a Github issue.
4-
* For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/) tagged appropriately.
5-
6-
### Step 2: Describe the problem:
7-
8-
#### Steps to reproduce:
9-
10-
1. _____
11-
2. _____
12-
3. _____
13-
141
#### Observed Results:
152

163
* What happened? This could be a description, log output, etc.

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ all: install test authors run
66
.PHONY: install
77
install: prepare-dev lint bundle
88

9+
.PHONY: clean
10+
clean:
11+
@docker images | \
12+
grep -i "^datadog/dev" | \
13+
awk '{ print $$3 }' | \
14+
xargs -P$(CORES) -I{} docker rmi -f {} 2> /dev/null || :
15+
916
.PHONY: perf
1017
perf:
1118
@./dev/siege.sh
@@ -16,7 +23,6 @@ fmt:
1623

1724
.PHONY: sync
1825
sync:
19-
docker-compose run --rm fetch
2026
docker-compose run --rm sync
2127

2228
.PHONY: lint

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
datadog-mock is a golang statsd mock server listening on port 8125 and relaying events to stdout.
44

5-
[![Build Status](https://circleci.com/gh/jancajthaml/datadog-mock.svg?style=svg)](https://circleci.com/gh/jancajthaml/datadog-mock) [![Static Analysis](https://api.codacy.com/project/badge/Grade/c5c255a292f84cf88972f92f74f9174d)](https://www.codacy.com/app/jan-cajthaml/datadog-mock?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=jancajthaml/datadog-mock&amp;utm_campaign=Badge_Grade) [![Test Coverage](https://coveralls.io/repos/github/jancajthaml/datadog-mock/badge.svg?branch=master)](https://coveralls.io/github/jancajthaml/datadog-mock?branch=master)
5+
[![Docker Version](https://images.microbadger.com/badges/version/jancajthaml/datadog_mock.svg)](https://microbadger.com/images/jancajthaml/datadog_mock)
6+
[![Build Status](https://circleci.com/gh/jancajthaml/datadog-mock.svg?style=shield)](https://circleci.com/gh/jancajthaml/datadog-mock) [![Static Analysis](https://api.codacy.com/project/badge/Grade/c5c255a292f84cf88972f92f74f9174d)](https://www.codacy.com/app/jan-cajthaml/datadog-mock?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=jancajthaml/datadog-mock&amp;utm_campaign=Badge_Grade) [![Test Coverage](https://coveralls.io/repos/github/jancajthaml/datadog-mock/badge.svg?branch=master)](https://coveralls.io/github/jancajthaml/datadog-mock?branch=master)
67

78
## Getting started ##
89

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

docker-compose.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ services:
2525
entrypoint: govendor
2626
command: ["sync", "-v"]
2727

28-
fetch:
29-
extends: dev
30-
image: datadog/dev:fetch
31-
entrypoint: govendor
32-
command: ["fetch", "github.com/ScottMansfield/nanolog"]
33-
3428
fmt:
3529
extends: dev
3630
image: datadog/dev:fmt

0 commit comments

Comments
 (0)