feedback
feedback copied to clipboard
Please update rust example
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:
- Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions-rs/[email protected]. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
- The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/[email protected]. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
- The
set-outputcommand is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
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.
@thomasrockhu-codecov is this something you can help with?
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.
@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 }}
Hi there!
I have published a bunch of "copy-pastable GHA workflows" for Rust here: https://github.com/Swatinem/rust-gha-workflows
The complete-ci workflow adds code coverage instrumentation based on cargo-llvm-cov, which I highly recommend over similar tools.
It also uses nextest as test runner which has built-in junit output support.
Both the test results as well as the coverage results are being uploaded to codecov in that workflow. Please take a look.