-
-
Save wandersoncferreira/bc3e912cf3d5f51c416ffae5d3e8042a to your computer and use it in GitHub Desktop.
How to setup code coverage for Clojure + Cloverage + CircleCI + CodeClimate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/clojure:lein-2.7.1 | |
environment: | |
- CC_TEST_REPORTER_ID=....set in project settings.... | |
steps: | |
- checkout | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ checksum "project.clj" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
- run: | |
name: 'Install cloverage plugin for Leiningen' | |
command: | | |
mkdir -p $HOME/.lein/ | |
echo '{ :user { :plugins [[lein-cloverage "1.1.1" :exclusions [org.clojure/clojure]]] } }' > $HOME/.lein/profiles.clj | |
- run: lein deps | |
- save_cache: | |
paths: | |
- ~/.m2 | |
key: v1-dependencies-{{ checksum "project.clj" }} | |
- run: | |
name: Setup Code Climate test-reporter | |
command: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
- run: | |
name: 'Run tests' | |
command: | | |
./cc-test-reporter before-build | |
LEIN_FAST_TRAMPOLINE=1 lein trampoline cloverage --lcov --no-text --no-html --no-summary -o $PWD | |
testRes=$? | |
mkdir -p coverage | |
mv lcov.info coverage/lcov.info | |
./cc-test-reporter after-build --coverage-input-type lcov --exit-code $testRes | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment