Skip to content

Commit

Permalink
ci: upload code coverage to Codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
johnyob authored and zcabter committed Aug 15, 2024
1 parent 132f97d commit 35a6cf0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ jobs:
- uses: Swatinem/[email protected]
- name: Rust setup
# FIXME: Once rustup adds a command to install a toolchain from rust-toolchain.toml, we can remove this.
run: rustup toolchain add 1.73.0 --profile minimal
run: rustup toolchain add 1.73.0 --profile minimal --component llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov

- name: Lint
run: make lint
Expand All @@ -58,8 +59,16 @@ jobs:
# (to avoid building both a release and a debug profile in CI).
run: PROFILE=dev make build

- name: Run unit tests
run: make test-unit
- name: Run unit tests (and generate coverage)
run: make ci-cov

- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
files: codecov.json
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build-docs:
name: Build Documentation
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,10 @@ fmt-check: fmt-nix-check fmt-rust-check fmt-js-check
lint:
@touch $(CLI_KERNEL_PATH)
@cargo clippy -- --no-deps -D warnings -A clippy::let_underscore_future -A clippy::module_inception -A clippy::op_ref -A clippy::manual_strip -A clippy::missing_safety_doc -A clippy::slow_vector_initialization -A clippy::empty_loop -A clippy::collapsible-match
@rm -f $(CLI_KERNEL_PATH)
@rm -f $(CLI_KERNEL_PATH)

.PHONY: ci-cov
ci-cov:
# This will only generate a coverage report for unit tests. We should add coverage
# for integration tests as well.
@cargo llvm-cov --lib --bins --codecov --output-path codecov.json
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 👨‍⚖️ jstz

[![codecov](https://codecov.io/gh/jstz-dev/jstz/graph/badge.svg?token=FA7IPI5Q9J)](https://codecov.io/gh/jstz-dev/jstz)

`jstz` (pronounced: "justice") is a JavaScript runtime powered by Tezos Smart Optimistic Rollups that uses [Boa](https://boajs.dev/) and is built in [Rust](https://www.rust-lang.org/).

## Install
Expand Down
22 changes: 22 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Configures a simple CI comment (instead of the more verbose default)
comment:
layout: "header, files, footer"
hide_project_coverage: false

# Configures coverage checks -- both patch and project-wide checks
# can drop by 5% before failing the CI build.
#
# Note: duplication required since the `default_rules` do not support
# the `target`, `threshold`, or `if_ci_failed` fields.
coverage:
status:
project:
default:
target: auto
threshold: 5%
if_ci_failed: success
patch:
default:
target: auto
threshold: 5%
if_ci_failed: success

0 comments on commit 35a6cf0

Please sign in to comment.