Skip to content

Commit

Permalink
build: add code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sritchie committed Aug 23, 2023
1 parent fd60aec commit b7cdc04
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: coverage

on:
pull_request:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: DeLaGuardo/setup-clojure@master
with:
cli: latest

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 17

- name: Cache m2
uses: actions/cache@v2
with:
path: ~/.m2
key: m2-${{ hashFiles('deps.edn') }}

- name: Cache gitlibs
uses: actions/cache@v2
with:
path: ~/.gitlibs
key: gitlibs-${{ hashFiles('deps.edn') }}

- name: Install dependencies
run: clojure -P -M:test:coverage

- name: generate coverage report
run: |
CLOVERAGE_VERSION=1.2.4 clojure -M:test:coverage --codecov || :
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
file: ./target/coverage/codecov.json
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<div align="center">

[![Build Status][build-status]][build-status-url]
[![License][license]][license-url]
[![Codecov branch][codecov]][codecov-url]
[![Linter][linter]][linter-url]
![Stability: Experimental][experimental-badge]

Expand Down Expand Up @@ -110,6 +112,8 @@ Distributed under the [Apache 2.0](LICENSE) license. See [LICENSE](LICENSE).
[build-status-url]: https://github.com/InferenceQL/gen.clj/actions/workflows/tests.yaml?query=branch%3Amain
[build-status]: https://github.com/InferenceQL/gen.clj/workflows/tests/badge.svg?branch=main
[clerk-url]: https://github.com/nextjournal/clerk
[codecov-url]: https://codecov.io/github/inferenceql/gen.clj
[codecov]: https://img.shields.io/codecov/c/github/inferenceql/gen.clj/main.svg?maxAge=3600
[experimental-badge]: https://img.shields.io/badge/stability-experimental-orange.svg
[gen-clj-url]: https://github.clerk.garden/inferenceql/gen.clj
[license-url]: LICENSE
Expand Down
7 changes: 7 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
:exec-fn cognitect.test-runner.api/test
:exec-args ["test"]}

:coverage
;; Invoke with clj -M:test:coverage <args>
{:main-opts ["-m" "cloverage.coverage"
"-p" "src"
"-s" "test"]
:extra-deps {cloverage/cloverage {:mvn/version "1.2.4"}}}

:build
{:deps
{io.github.clojure/tools.build {:git/tag "v0.9.4" :git/sha "76b78fe"}
Expand Down

0 comments on commit b7cdc04

Please sign in to comment.