Giter VIP home page Giter VIP logo

Comments (4)

foresterre avatar foresterre commented on May 27, 2024 1

Hi @Skallwar, that's indeed possible 😄. You can include the tests by running cargo msrv with the following arguments: cargo msrv -- cargo check --tests --all, or if you also want to execute the test cases cargo msrv -- cargo test --all. Since the test cases are generally not consumed by library consumers, these are not included by default.

In fact, any program runnable through rustup run can be used, and specified as the last argument, after the two dashes.

from cargo-msrv.

foresterre avatar foresterre commented on May 27, 2024 1

I won't claim to know whether there is a consensus on a best practice 🙂. In the projects of others I usually see tests being evaluated on both stable and the MSRV. I think that this configuration is used for at least two reasons:

  • executing tests on MSRV as well (as stable) may have a small extra chance to catch out bugs caused by a toolchain (such as inadvertently introduced incompatibilities; such bugs are difficult to spot)
  • it's easy to configure testing for both since usually you can simply add another toolchain version by including it in your build matrix
  • if you have the build capacity, the stable and MSRV instances can run in parallel, not costing extra build time

There are also disadvantages to testing on additional platforms (e.g. MSRV) such as:

  • if you have limited resources (e.g. for non public projects), CI minutes can become quite expensive
  • if you have a smaller amount of parallel builds, or simply have a large test suite, the run time of the test suite may take a significant amount of time (which may also block other people from running their PR's on the CI workers)

For my own projects, I usually:

  • run the tests on at least the latest backwards compatible stable
  • run an MSRV instance with cargo check --all (i.e. building without linking) which has the aim of verifying consumers of a library can safely compile it as part of their project, within their own MSRV.

The test instances help me find defects within my code and configuration; the MSRV check tries to ensure a crate is able to run on a specific language feature set.

For me, this is usually the right balance between practicality and stability on this matter.

I'm however always interested in learning new developments in this area :).

from cargo-msrv.

Skallwar avatar Skallwar commented on May 27, 2024

I'm wondering if my CI should only run the test with a stable version and try to build with both stable and MSRV. I don't what is the best practice for this

from cargo-msrv.

Skallwar avatar Skallwar commented on May 27, 2024

Thanks a lot for taking the time to explain everything

from cargo-msrv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.