diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 42f7449..3abf379 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,8 +11,37 @@ env: jobs: test: + name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 - name: Run tests run: cargo test --verbose + + coverage: + # template: https://github.com/marketplace/actions/rust-tarpaulin + name: Coverage + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Run cargo-tarpaulin + uses: actions-rs/tarpaulin@v0.1 + with: + version: '0.9.0' + args: '-- --test-threads 1' + - name: Upload to codecov.io + uses: codecov/codecov-action@v1.0.2 + with: + token: ${{secrets.CODECOV_TOKEN}} + - name: Archive code coverage results + uses: actions/upload-artifact@v1 + with: + name: code-coverage-report + path: cobertura.xml diff --git a/README.md b/README.md index 3dbdfa8..23347a7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # LeetCode in Rust ![Unittest](https://github.com/jtr109/leetcode-in-rust/workflows/Unittest/badge.svg) +[![codecov](https://codecov.io/gh/jtr109/leetcode-in-rust/branch/master/graph/badge.svg)](https://codecov.io/gh/jtr109/leetcode-in-rust) Resolving problems of LeetCode in RustLang.