From cafca1c82fca058b5880b093d870ad5780858414 Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Sat, 2 Jun 2018 14:40:43 +0000 Subject: [PATCH] Add codecov.io integration. --- .travis.yml | 15 ++++++++++++++- Dockerfile | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 067111d05..09a8ddbf2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,20 @@ services: install: true script: - - docker build . + - docker build + --build-arg CODECOV_TOKEN=$CODECOV_TOKEN + --build-arg CI=$CI + --build-arg TRAVIS=$TRAVIS + --build-arg TRAVIS_BRANCH=$TRAVIS_BRANCH + --build-arg TRAVIS_COMMIT=$TRAVIS_COMMIT + --build-arg TRAVIS_JOB_ID=$TRAVIS_JOB_ID + --build-arg TRAVIS_JOB_NUMBER=$TRAVIS_JOB_NUMBER + --build-arg TRAVIS_OS_NAME=$TRAVIS_OS_NAME + --build-arg TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST + --build-arg TRAVIS_PULL_REQUEST_SHA=$TRAVIS_PULL_REQUEST_SHA + --build-arg TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG + --build-arg TRAVIS_TAG=$TRAVIS_TAG + . addons: code_climate: diff --git a/Dockerfile b/Dockerfile index 396cb5c21..37b04a022 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,18 @@ FROM gobuffalo/buffalo:development +ARG CODECOV_TOKEN +ARG CI +ARG TRAVIS +ARG TRAVIS_BRANCH +ARG TRAVIS_COMMIT +ARG TRAVIS_JOB_ID +ARG TRAVIS_JOB_NUMBER +ARG TRAVIS_OS_NAME +ARG TRAVIS_PULL_REQUEST +ARG TRAVIS_PULL_REQUEST_SHA +ARG TRAVIS_REPO_SLUG +ARG TRAVIS_TAG + RUN buffalo version RUN go get -u github.com/alecthomas/gometalinter @@ -29,6 +42,12 @@ RUN go get -v -t ./... RUN go install -v -tags sqlite ./buffalo RUN go test -tags sqlite -race ./... +RUN go test -tags sqlite -coverprofile cover.out -covermode count ./... + +RUN if [ -z "$CODECOV_TOKEN" ] ; then \ + echo codecov not enabled ; \ + else curl -s https://codecov.io/bash -o codecov && \ + bash codecov -f cover.out -X fix; fi RUN gometalinter --vendor --deadline=5m ./...