codecov / feedback

A place to discuss feedback about the pull request and web product experience.
38 stars 9 forks source link

Please update rust example #300

Open AMDmi3 opened 8 months ago

AMDmi3 commented 8 months ago

What product do you want to improve? Codecov Rust Example

Is your feature request related to a problem? Please describe. The example works, however I see several deprecation notices from GitHub (all originating from actions used in the example), such as:

For instance, actions-rs/grcov action was updated 4 years ago and is now archived, so it's likely to break anytime. Same for actions-rs/toolchain action, but in my repository I've switched to dtolnay/rust-toolchain. At the very least, you should update your own codecov/codecov-action from @v4-beta to @v4 and actions/checkout from @v3 to @v4

Describe the solution you'd like I'd like the example to refer to maintained actions which do not result in deprecation notices.

rohan-at-sentry commented 7 months ago

@thomasrockhu-codecov is this something you can help with?

AMDmi3 commented 7 months ago

For the record, I've set up coverage for myself, see:

https://github.com/AMDmi3/omnilinter/blob/d51e6ead04732aa943b9e2424a744b737a2089cb/.github/workflows/ci.yml#L40-L66

it uses modern -Cinstrument-coverage and grcov. Not sure of something can be optimized.

ethicnology commented 1 week ago

@AMDmi3 Thank you a lot, I've faced errors with the provided link

Run cargo test --features coverage
error: the package '<package>' does not contain this feature: coverage

I've fixed it by removing --features coverage, here updated:

name: coverage

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  coverage:
    runs-on: ubuntu-latest
    name: Coverage
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: nightly
          components: llvm-tools-preview

      - name: Test
        run: cargo test
        env:
          RUSTFLAGS: "-Cinstrument-coverage"
          RUSTDOCFLAGS: "-Cinstrument-coverage"
          LLVM_PROFILE_FILE: "${{ github.workspace }}/default_%m_%p.profraw"

      - name: Collect coverage
        run: |
          curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.19/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar -xjf-
          ./grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --keep-only 'src/*' --ignore '**/tests.rs' -o coverage.lcov

      - name: Submit coverage
        uses: codecov/codecov-action@v4
        with:
          fail_ci_if_error: true
          files: ./coverage.lcov
          token: ${{ secrets.CODECOV_TOKEN }}