diff --git a/.codecov.yaml b/.codecov.yaml new file mode 100644 index 0000000..96cf9ea --- /dev/null +++ b/.codecov.yaml @@ -0,0 +1,7 @@ +# https://docs.codecov.com/docs/commit-status#disabling-a-status +coverage: + status: + project: off + patch: off + +comment: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ef8d1b..a581830 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,15 +14,26 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - - run: cargo test --features=search,termwiz,termion,arbitrary + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Run tests on Linux or macOS + run: | + cargo llvm-cov --color always --lcov --output-path lcov.info --features=search,termwiz,termion,arbitrary + cargo llvm-cov --color always --no-run if: ${{ matrix.os != 'windows-latest' }} - - run: cargo test --features=search,termwiz,arbitrary + - name: Run tests on Windows + run: | + cargo llvm-cov --color always --lcov --output-path lcov.info --features=search,termwiz,arbitrary + cargo llvm-cov --color always --no-run if: ${{ matrix.os == 'windows-latest' }} - run: cargo test --no-default-features --features=tuirs-crossterm,search -- --skip .rs - run: cargo test --no-default-features --features=tuirs-termion,search -- --skip .rs if: ${{ matrix.os != 'windows-latest' }} - run: cargo test --no-default-features --features=no-backend,search -- --skip .rs - run: cargo test --no-default-features --features=tuirs-no-backend,search -- --skip .rs + - uses: codecov/codecov-action@v3 + with: + files: lcov.info lint: runs-on: ubuntu-latest steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17c32f6..9fd93aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,6 +38,14 @@ Note: On Windows, remove `termion` and `tuirs-termion` features from `--features If you use [cargo-watch][], `cargo watch-check` and `cargo watch-test` aliases are useful to run checks/tests automatically on files being changed. +### Code coverage + +Code coverage is monitored on [codecov][]. + +https://app.codecov.io/gh/rhysd/tui-textarea + +When you implement some new feature, consider to add new unit tests which cover your implementation. + ## Print debugging Since this crate uses stdout, `println!` is not available for debugging. Instead, stderr through [`eprintln!`][eprintln] @@ -99,3 +107,4 @@ See [README in bench/](./bench/README.md) for more details. [criterion]: https://github.com/bheisler/criterion.rs [eprintln]: https://doc.rust-lang.org/std/macro.eprintln.html [dbg]: https://doc.rust-lang.org/std/macro.dbg.html +[codecov]: https://about.codecov.io/ diff --git a/README.md b/README.md index 3230b45..a2befee 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ tui-textarea [![crate][crates-io-badge]][crate] [![docs][doc-badge]][doc] [![CI][ci-badge]][ci] +[![coverage][codecov-badge]][codecov] [tui-textarea][crate] is a simple yet powerful text editor widget like `