Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Go Httpbin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Nix
Go Httpbin
Commits
14104773
Commit
14104773
authored
5 years ago
by
Will McCutchen
Browse files
Options
Downloads
Patches
Plain Diff
Wire up automated code coverage reports
parent
a4ee88cb
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.codecov.yml
+32
-0
32 additions, 0 deletions
.codecov.yml
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
.travis.yml
+19
-2
19 additions, 2 deletions
.travis.yml
Makefile
+28
-13
28 additions, 13 deletions
Makefile
with
80 additions
and
15 deletions
.codecov.yml
0 → 100644
+
32
−
0
View file @
14104773
# To validate this config:
#
# cat codecov.yml | curl --data-binary @- https://codecov.io/validate
#
# See https://docs.codecov.io/docs for more info
# https://docs.codecov.io/docs/coverage-configuration
coverage
:
precision
:
2
round
:
down
range
:
"
90..100"
# https://docs.codecov.io/docs/commit-status
status
:
target
:
auto
threshold
:
2
patch
:
no
changes
:
no
parsers
:
gcov
:
branch_detection
:
conditional
:
yes
loop
:
yes
method
:
no
macro
:
no
# https://docs.codecov.io/docs/pull-request-comments
comment
:
layout
:
"
header,
diff,
files"
behavior
:
default
require_changes
:
no
This diff is collapsed.
Click to expand it.
.gitignore
+
1
−
0
View file @
14104773
...
...
@@ -24,3 +24,4 @@ _testmain.go
*.prof
dist/*
coverage.txt
This diff is collapsed.
Click to expand it.
.travis.yml
+
19
−
2
View file @
14104773
...
...
@@ -5,9 +5,26 @@ go:
-
'
1.10'
-
'
1.11'
-
'
1.12'
go_import_path
:
github.com/mccutchen/go-httpbin
script
:
-
make lint
-
make test
-
make testci
after_success
:
# Upload test coverage results to codecov.io
# https://github.com/codecov/example-go/blob/b85638743b972bd0bd2af63421fe513c6f968930/README.md
-
bash <(curl -s https://codecov.io/bash)
# With this filter, we aim to restrict Travis's "Build Pushes" feature to build
# only pushes to master, while allowing the "Build Pull Requests" to build all
# incoming pull requests without redundant double-builds.
#
# This is confusing on Travis's end; this captures the exact problem we're
# trying to solve:
# https://stackoverflow.com/a/31882307
branches
:
only
:
-
master
notifications
:
email
:
false
This diff is collapsed.
Click to expand it.
Makefile
+
28
−
13
View file @
14104773
.PHONY
:
clean deploy deps image imagepush lint run stagedeploy test testcover
.PHONY
:
clean deploy deps image imagepush lint run stagedeploy test
testci
testcover
GCLOUD_PROJECT
?=
httpbingo
TEST_ARGS
?=
-race
# The version that will be used in docker tags (e.g. to push a
# go-httpbin:latest image use `make imagepush VERSION=latest)`
VERSION
?=
$(
shell git rev-parse
--short
HEAD
)
# Override this to deploy to a different App Engine project
GCLOUD_PROJECT
?=
httpbingo
# Built binaries will be placed here
DIST_PATH
?=
dist
# Default flags used by the test, testci, testcover targets
COVERAGE_PATH
?=
coverage.txt
COVERAGE_ARGS
?=
-covermode
=
atomic
-coverprofile
=
$(
COVERAGE_PATH
)
TEST_ARGS
?=
-race
GENERATED_ASSETS_PATH
:=
httpbin/assets/assets.go
BIN_DIR
:=
$(
GOPATH
)
/bin
...
...
@@ -15,16 +26,16 @@ GO_SOURCES = $(wildcard **/*.go)
# =============================================================================
# build
# =============================================================================
build
:
dist
/go-httpbin
build
:
$(DIST_PATH)
/go-httpbin
dist
/go-httpbin
:
assets $(GO_SOURCES)
mkdir
-p
dist
go build
-o
dist
/go-httpbin ./cmd/go-httpbin
$(DIST_PATH)
/go-httpbin
:
assets $(GO_SOURCES)
mkdir
-p
$(
DIST_PATH
)
go build
-o
$(
DIST_PATH
)
/go-httpbin ./cmd/go-httpbin
assets
:
$(GENERATED_ASSETS_PATH)
clean
:
rm
-r
dist
rm
-r
f
$(
DIST_PATH
)
$(
COVERAGE_PATH
)
$(GENERATED_ASSETS_PATH)
:
$(GOBINDATA) static/*
$(
GOBINDATA
)
-o
$(
GENERATED_ASSETS_PATH
)
-pkg
=
assets
-prefix
=
static static
...
...
@@ -42,10 +53,14 @@ $(GENERATED_ASSETS_PATH): $(GOBINDATA) static/*
test
:
go
test
$(
TEST_ARGS
)
./...
testcover
:
mkdir
-p
dist
go
test
$(
TEST_ARGS
)
-coverprofile
=
dist/coverage.out github.com/mccutchen/go-httpbin/httpbin
go tool cover
-html
=
dist/coverage.out
# Test command to run for continuous integration, which includes code coverage
# based on codecov.io's documentation:
# https://github.com/codecov/example-go/blob/b85638743b972bd0bd2af63421fe513c6f968930/README.md
testci
:
go
test
$(
TEST_ARGS
)
$(
COVERAGE_ARGS
)
./...
testcover
:
testci
go tool cover
-html
=
$(
COVERAGE_PATH
)
lint
:
$(GOLINT)
test
-z
"
$$(
gofmt -d -s -e .
)
"
||
(
gofmt
-d
-s
-e
.
;
exit
1
)
...
...
@@ -63,7 +78,7 @@ stagedeploy: build
gcloud app deploy
--quiet
--project
=
$(
GCLOUD_PROJECT
)
--version
=
$(
VERSION
)
--no-promote
run
:
build
./dist
/go-httpbin
$(
DIST_PATH
)
/go-httpbin
# =============================================================================
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment