Skip to content

Commit

Permalink
ROLLUP-286: add code coverage (#94)
Browse files Browse the repository at this point in the history
* chore: ignore temp files used to generate code coverage report

* chore: add pull request description template

* ci:remove prover test because already included in server-rust

* test: allow the possibility to measure unit test code coverage

* doc: describe how to measure code coverage and generate reports

* ci: rename workflows

* style: zk fmt

* style: fix markdown style issue

* style: zk fmt

* ci: remove unused command

* docs: include required tools to generate code coverage

* ci: add code coverage tools to zk image

* ci: rename docker workflow

* ci: measure unit test code coverage

* refactor: avoid code duplication

* ci: fix yaml syntax

* ci: replace code coverage action

* ci: create intermediate directories for coverage report

* ci: debug prover tests

* chore: debug lint issues

* build: add cargo.lock

* Revert "build: add cargo.lock"

This reverts commit 29942d6.

* ci: fix rust version used for lint

* ci: install clippy using rustup

* ci: install rustfmt with rustup

* ci: debug unit test failing

* chore: update tests and docs according to PR suggestions

* ci: debug ci fails

* ci(debug): debug failing test

* test: fix failing test

* build: restore Cargo.lock

* build: restore Cargo.lock

* ci: enable all the tests

* ci: debug coverage file size

* ci: debug coverage file size

* ci: debug coverage file size

* ci: debug coverage file size

* ci: test lcov file size

* ci: test lcov file size

* ci: test cobertura file size

* Revert "ci: test cobertura file size"

This reverts commit d599910.

* ci: enable all the tests

* test: increate prover timeout

* test: increate prover timeout

* ci: enable ci to run only when the PR is ready
  • Loading branch information
antomor authored Sep 18, 2023
1 parent a3fdb5c commit a42fdf1
Show file tree
Hide file tree
Showing 13 changed files with 233 additions and 58 deletions.
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- markdownlint-disable-file MD041 -->

## What

- (describe the changes)

## Why

- (the reason these changes are wanted)

## Refs

- (optional: include links to other issues, PRs, tickets, etc)
10 changes: 7 additions & 3 deletions .github/workflows/ci-iov-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: rif-rollup CI lint
name: Lint
on: [push]

jobs:
Expand All @@ -14,13 +14,17 @@ jobs:
node-version: "16.x"

- name: Use rust
run: rustup install 1.69.0
run: |
rustup install 1.69.0
rustup default 1.69.0
rustup component add clippy
rustup component add rustfmt
- name: Toolchain info
run: |
node --version
rustc --version
cargo clippy --version
cargo clippy --version
- name: setup-env
run: |
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci-iov-sim-tool.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: rif-rollup CI unit/integration tests
name: Simulation tool tests
on:
push:
paths:
Expand All @@ -20,9 +20,7 @@ jobs:
- name: start-services
run: |
which ci_run
docker-compose -f docker-compose-runner.yml up --build -d zk
which ci_run
- name: init
run: |
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/ci-iov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: rif-rollup CI unit/integration tests
on:
name: Unit/integration tests
on:
pull_request:
types: [ready_for_review]

Expand Down Expand Up @@ -47,12 +47,15 @@ jobs:
- name: restart dev-ticker
run: docker-compose -f docker-compose-runner.yml restart dev-ticker

- name: Toolchain info
run: |
node --version
ci_run rustc --version
ci_run cargo clippy --version
- name: contracts-unit-tests
run: ci_run zk test contracts

- name: prover-unit-tests
run: ci_run zk test prover

- name: witness-generator-unit-tests
run: ci_run zk test witness-generator

Expand Down Expand Up @@ -107,4 +110,15 @@ jobs:
run: |
ci_run cat server.log
ci_run cat api.log
ci_run cat dummy_prover.log
ci_run cat dummy_prover.log
ci_run mkdir -p ./target/release/coverage/
ci_run "grcov . --binary-path ./target/release/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore '/*' -o ./target/release/coverage/lcov.info"
docker compose -f docker-compose-runner.yml cp zk:/usr/src/zksync/target/release/coverage/lcov.info lcov.info
du lcov.info
- uses: codecov/codecov-action@v3
with:
files: ./lcov.info
flags: unit-tests
name: codecov-umbrella # optional
verbose: true # optional (default = false)
2 changes: 1 addition & 1 deletion .github/workflows/convert-draft.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: rif-rollup Mark as draft
name: Mark as draft
on:
pull_request_review:
types: [submitted]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: publish server docker image
name: Publish docker images

on:
push:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ flamegraph.svg
bin/mkcert

docker/rskj/data

# Files used to generate code-coverage reports
*.profraw
Loading

0 comments on commit a42fdf1

Please sign in to comment.