.circleci/config.yml
version: 2.1
workflows:
test:
jobs:
- test
jobs:
test:
docker:
- image: circleci/golang:1.11.2
working_directory: /go/src/github.com/akrfjmt/di114514
steps:
- checkout
- run:
command: |
if [ "$CC_TEST_REPORTER_ID" != "" ]; then
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x cc-test-reporter
./cc-test-reporter before-build
fi
go test -v -race -coverprofile coverage.txt -covermode=atomic ./...
TEST_EXIT_CODE="$?"
if [ "$CC_TEST_REPORTER_ID" != "" ]; then
cp -a coverage.txt c.out
./cc-test-reporter after-build --coverage-input-type gocov --exit-code $TEST_EXIT_CODE
rm c.out
fi
if [ "$CODECOV_TOKEN" != "" ]; then
curl -s https://codecov.io/bash | bash -s --
fi
if [ "$COVERALLS_TOKEN" != "" ]; then
go get github.com/mattn/goveralls
goveralls -coverprofile=coverage.txt -covermode=atomic -service=circle-ci -repotoken $COVERALLS_TOKEN
fi