Skip to content

Commit

Permalink
build: add code coverage action
Browse files Browse the repository at this point in the history
  • Loading branch information
sritchie authored and Schaechtle committed Apr 11, 2024
1 parent 60b198b commit b9c43d7
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 12 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: coverage

on:
pull_request:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 17

- name: Setup Clojure tools
uses: DeLaGuardo/setup-clojure@master
with:
cli: 1.10.3.1040

- name: Setup node
uses: actions/setup-node@v2

- name: Checkout repository
uses: actions/checkout@v2

- name: Install ws
run: npm install ws

- 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: Prepare dependencies
run: clojure -P -M:test:clj-test:coverage

- name: generate coverage report
run: |
CLOVERAGE_VERSION=1.2.4 clojure -M:test:coverage --codecov || :
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./target/coverage/codecov.json
token: ${{ secrets.CODECOV_TOKEN }}
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# GenSQL.query

![tests](https://github.com/OpenGen/GenSQL.query/workflows/tests/badge.svg)
![linter](https://github.com/OpenGen/GenSQL.query/workflows/linter/badge.svg)
[![Codecov branch][codecov]][codecov-url]

## Usage

### Dependencies and Nix

Many of the usages described below are powered by the Nix package manager, which
works on most Unix systems. We recommend installing Nix with the
[Determinate Systems installer](https://determinate.systems/posts/determinate-nix-installer/).
If you already have Nix installed, note that the precise minimum version of Nix
Many of the usages described below are powered by the Nix package manager, which
works on most Unix systems. We recommend installing Nix with the
[Determinate Systems installer](https://determinate.systems/posts/determinate-nix-installer/).
If you already have Nix installed, note that the precise minimum version of Nix
required is not known, but we have tested with Nix 2.19.3:

```shell
Expand Down Expand Up @@ -78,20 +80,20 @@ To develop with a cljs environment, use shadow-cljs. The simplest way is to use
##### Terminal
From the command line, run:

```shell
npx shadow-cljs node-repl # start a CLI node repl
```shell
npx shadow-cljs node-repl # start a CLI node repl
```

##### Editor nREPL
First, from the command line, run:

```shell
```shell
npx shadow-cljs server # start the shadow-cljs server
```

Then, connect to the nREPL server in your editor with the standard .nrepl-port file. (This process will be editor-specific.)

This will get you a **Clojure**-based REPL in your editor. To convert it to **Clojurescript**, in the REPL, run:
This will get you a **Clojure**-based REPL in your editor. To convert it to **Clojurescript**, in the REPL, run:

```clojure
(shadow/node-repl) ; starts a bare node repl
Expand All @@ -109,9 +111,9 @@ clj -M -m inferenceql.query.main --help

#### Testing

Make sure [babashka](https://github.com/babashka/babashka) is installed. Then
run the tests via `bb test`. Dialect-specific tests can be run with
`bb test:clj` and `bb test:cljs`.
Make sure [babashka](https://github.com/babashka/babashka) is installed. Then
run the tests via `bb test`. Dialect-specific tests can be run with
`bb test:clj` and `bb test:cljs`.

#### Dependency upgrades

Expand All @@ -134,3 +136,6 @@ release build will work again.
```shell
nix build '.#uber' -o gensql.jar
```

[codecov-url]: https://codecov.io/github/OpenGen/GenSQL.query
[codecov]: https://img.shields.io/codecov/c/github/OpenGen/GenSQL.query/main.svg?maxAge=3600
9 changes: 8 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@
:perf {:extra-paths ["perf"]
:extra-deps {com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.2.0"}
criterium/criterium {:mvn/version "0.4.6"}}
:jvm-opts ["-Djdk.attach.allowAttachSelf"]}}}
:jvm-opts ["-Djdk.attach.allowAttachSelf"]}

: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"}}}}}

0 comments on commit b9c43d7

Please sign in to comment.