Spent 2 hours to figure out how to automate Coveralls checking in CircleCI, the online articles are really outdated and not working…
You will need this library
The idea is to run test coverage and save it into a file, then use the above lib to post it to Coveralls.
Don’t forget to put
$COVERALLS_TOKEN in your CircleCI.
The tricky part is to find out how to save the output file and how to pick it up using
Here is the compete
version: 2.1 jobs: build: docker: - image: circleci/golang:1.12 steps: - checkout - run: name: run build command: | go build -v test: working_directory: ~/test docker: - image: circleci/golang:1.12 steps: - checkout - run: name: run test command: | GO111MODULE=off go get github.com/mattn/goveralls go test -v -cover -race -coverprofile=coverage.out $GOPATH/bin/goveralls -coverprofile=/home/circleci/test/coverage.out -service=circle-ci -repotoken=$COVERALLS_TOKEN workflows: version: 2.1 build_and_test: jobs: - build - test