├── .github └── workflows │ ├── ci.yml │ └── enforce-license-compliance.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── project.clj ├── src └── codecov │ ├── calc.clj │ └── core.clj └── test └── codecov ├── calc_test.clj └── core_test.clj /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Workflow for example-clojure 2 | on: [push, pull_request] 3 | jobs: 4 | run: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Checkout 8 | uses: actions/checkout@v4 9 | - name: Setup Java 10 | uses: actions/setup-java@v2 11 | with: 12 | distribution: 'adopt' 13 | java-version: '11' 14 | check-latest: true 15 | - name: Run tests 16 | run: lein test 17 | - name: Cloverage 18 | run: CLOVERAGE_VERSION=1.1.1 lein cloverage --codecov 19 | - name: Upload to Codecov 20 | uses: codecov/codecov-action@v5 21 | env: 22 | CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }} 23 | with: 24 | file: target/coverage/codecov.json 25 | -------------------------------------------------------------------------------- /.github/workflows/enforce-license-compliance.yml: -------------------------------------------------------------------------------- 1 | name: Enforce License Compliance 2 | 3 | on: 4 | pull_request: 5 | branches: [main, master] 6 | 7 | jobs: 8 | enforce-license-compliance: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: 'Enforce License Compliance' 12 | uses: getsentry/action-enforce-license-compliance@57ba820387a1a9315a46115ee276b2968da51f3d # main 13 | with: 14 | fossa_api_key: ${{ secrets.FOSSA_API_KEY }} 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /classes 3 | /checkouts 4 | pom.xml 5 | pom.xml.asc 6 | *.jar 7 | *.class 8 | /.lein-* 9 | /.nrepl-port 10 | /.idea 11 | /codecov-clojure.iml 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: clojure 2 | jdk: 3 | - oraclejdk11 4 | - openjdk11 5 | script: 6 | - lein test 7 | after_success: 8 | - CLOVERAGE_VERSION=1.1.1 lein cloverage --codecov 9 | - bash <(curl -s https://codecov.io/bash) -f target/coverage/codecov.json 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Codecov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Codecov][1] Clojure example 2 | 3 | [![Build Status](https://github.com/codecov/example-clojure/actions/workflows/ci.yml/badge.svg)] 4 | [![codecov.io](https://codecov.io/github/codecov/example-clojure/coverage.svg?branch=master)](https://codecov.io/github/codecov/example-clojure?branch=master) 5 | 6 | ## Guide 7 | ### GitHub Actions Step 8 | Add to your workflows file. 9 | ```yml 10 | - name: Upload to Codecov (Action) 11 | uses: codecov/codecov-action@v2 12 | with: 13 | token: {{ token }} 14 | ``` 15 | or 16 | ```yml 17 | - name: Upload to Codecov (Uploader) 18 | run: | 19 | curl -Os https://uploader.codecov.io/latest/linux/codecov 20 | chmod +x codecov 21 | ./codecov -t {{ token }} 22 | ``` 23 | ### Producing Coverage Reports 24 | > Add to your `project.clj` 25 | 26 | ```clojure 27 | :plugins [[lein-cloverage "1.1.1"]] 28 | ``` 29 | 30 | ``` 31 | CLOVERAGE_VERSION=1.1.1 lein cloverage --codecov 32 | ``` 33 | 34 | This uses [cloverage with the @dlobue's codecov.io reporter](https://github.com/lshift/cloverage/pull/78). 35 | 36 | 1. More documentation at https://docs.codecov.io 37 | 2. Configure codecov through the `codecov.yml` https://docs.codecov.io/docs/codecov-yaml 38 | 39 | ## License 40 | 41 | MIT. 42 | 43 | Originally authored by [Jakub Elżbieciak](https://elzbieciak.pl/). 44 | 45 | We are happy to help if you have any questions. Please contact email our Support at [support@codecov.io](mailto:support@codecov.io) 46 | 47 | [1]: https://codecov.io/ 48 | -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject codecov-clojure "0.1.0" 2 | :description "codecov.io, example Clojure project" 3 | :url "https://github.com/codecov/example-clojure" 4 | :plugins [[lein-cloverage "1.0.7-SNAPSHOT"]] 5 | :dependencies [[org.clojure/clojure "1.7.0"]]) 6 | -------------------------------------------------------------------------------- /src/codecov/calc.clj: -------------------------------------------------------------------------------- 1 | (ns codecov.calc) 2 | 3 | (defn add [a b] 4 | (+ a b)) 5 | 6 | (defn mul [a b] 7 | (* a b)) 8 | -------------------------------------------------------------------------------- /src/codecov/core.clj: -------------------------------------------------------------------------------- 1 | (ns codecov.core) 2 | 3 | (defn hello [x] 4 | (if (= (clojure.string/lower-case x) "world") 5 | "Not again!" 6 | (str "Hello, " x "!"))) 7 | 8 | (defn uncovered [] 9 | "Very sad, uncovered fn.") 10 | -------------------------------------------------------------------------------- /test/codecov/calc_test.clj: -------------------------------------------------------------------------------- 1 | (ns codecov.calc-test 2 | (:require [clojure.test :refer :all] 3 | [codecov.calc :as c])) 4 | 5 | (deftest calculations 6 | (testing "adding" 7 | (is (= (c/add 1 2) 3)) 8 | (is (= (c/add 1 -2) -1))) 9 | (testing "multiplying" 10 | (is (= (c/mul 0 1) 0)) 11 | (is (= (c/mul 2 2) 4)) 12 | (is (= (c/mul -1 2) -2)) 13 | (is (= (c/mul -1 -3) 3)))) 14 | -------------------------------------------------------------------------------- /test/codecov/core_test.clj: -------------------------------------------------------------------------------- 1 | (ns codecov.core-test 2 | (:require [clojure.test :refer :all] 3 | [codecov.core :as c])) 4 | 5 | (deftest greetings 6 | (testing "with an arbitrary string" 7 | (is (= (c/hello "Jakub") "Hello, Jakub!"))) 8 | (testing "with a forbidden word" 9 | (is (= (c/hello "World") "Not again!")))) 10 | --------------------------------------------------------------------------------