Skip to content

Commit

Permalink
feature: code coverage support (#1064)
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Caglayan <alizter@gmail.com>
  • Loading branch information
Alizter committed Apr 29, 2023
1 parent 07ba12b commit d972723
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,34 @@ jobs:

- name: Run the template integration tests
run: opam exec -- make test-e2e

coverage:
name: Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ocaml-compiler:
- 4.14.x
steps:
- uses: actions/checkout@v3
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext: false

- name: Set git user
run: |
git config --global user.name github-actions[bot]
git config --global user.email github-actions[bot]@users.noreply.github.com
- name: Install deps on Unix
run: |
opam install . --deps-only
opam exec -- make coverage-deps install-test-deps
- run: opam exec -- make test-coverage
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_NUMBER: ${{ github.event.number }}
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,12 @@ nix-fmt:
$(MAKE) yarn-install
dune build @fmt --auto-promote
cd $(TEST_E2E_DIR) && yarn fmt

.PHONY: coverage-deps
coverage-deps:
opam install -y bisect_ppx

.PHONY: test-coverage
test-coverage:
dune build --instrument-with bisect_ppx --force @lsp/test/runtest @lsp-fiber/runtest @jsonrpc-fiber/runtest @ocaml-lsp-server/runtest
bisect-ppx-report send-to Coveralls
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# OCaml-LSP <!-- omit from toc -->
<!-- TOC is updated automatically by "Markdown All in One" vscode extension -->

[![Build](https://github.com/ocaml/ocaml-lsp/workflows/Build%20and%20Test/badge.svg)](https://github.com/ocaml/ocaml-lsp/actions)
[![Build][build-badge]][build]
[![Coverage Status][coverall-badge]][coverall]

[build-badge]: https://github.com/ocaml/ocaml-lsp/workflows/Build%20and%20Test/badge.svg
[build]: https://github.com/ocaml/ocaml-lsp/actions
[coverall-badge]: https://coveralls.io/repos/github/ocaml/ocaml-lsp/badge.svg?branch=master
[coverall]: https://coveralls.io/github/ocaml/ocaml-lsp?branch=master

OCaml-LSP is a language server for OCaml that implements [Language Server
Protocol](https://microsoft.github.io/language-server-protocol/) (LSP).
Expand All @@ -27,6 +33,7 @@ Protocol](https://microsoft.github.io/language-server-protocol/) (LSP).
- [Unusual features](#unusual-features)
- [Debugging](#debugging)
- [Contributing to project](#contributing-to-project)
- [Changelog](#changelog)
- [Tests](#tests)
- [Relationship to Other Tools](#relationship-to-other-tools)
- [History](#history)
Expand Down
4 changes: 3 additions & 1 deletion jsonrpc-fiber/src/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(library
(name jsonrpc_fiber)
(libraries fiber dyn jsonrpc ppx_yojson_conv_lib stdune yojson))
(libraries fiber dyn jsonrpc ppx_yojson_conv_lib stdune yojson)
(instrumentation
(backend bisect_ppx)))
4 changes: 3 additions & 1 deletion jsonrpc/src/dune
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
(library
(public_name jsonrpc))
(public_name jsonrpc)
(instrumentation
(backend bisect_ppx)))
4 changes: 3 additions & 1 deletion lsp-fiber/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
lsp
ppx_yojson_conv_lib
stdune
yojson))
yojson)
(instrumentation
(backend bisect_ppx)))
4 changes: 3 additions & 1 deletion lsp/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
(public_name lsp)
(libraries jsonrpc ppx_yojson_conv_lib uutf yojson)
(lint
(pps ppx_yojson_conv)))
(pps ppx_yojson_conv))
(instrumentation
(backend bisect_ppx)))

(cinaps
(files types.ml types.mli)
Expand Down
4 changes: 3 additions & 1 deletion ocaml-lsp-server/bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
(name main)
(package ocaml-lsp-server)
(public_name ocamllsp)
(libraries dune-build-info stdune lsp ocaml_lsp_server))
(libraries dune-build-info stdune lsp ocaml_lsp_server)
(instrumentation
(backend bisect_ppx)))
4 changes: 3 additions & 1 deletion ocaml-lsp-server/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
ocamlformat-rpc-lib
ocamlc-loc)
(lint
(pps ppx_yojson_conv)))
(pps ppx_yojson_conv))
(instrumentation
(backend bisect_ppx)))

(include_subdirs unqualified)
1 change: 1 addition & 0 deletions submodules/lev/.github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ jobs:
- run: opam install --deps-only --with-doc --with-test .
- run: opam exec -- dune build
- run: opam exec -- dune runtest

0 comments on commit d972723

Please sign in to comment.