Optionally build and run application and examples during testing #76

Closed
opened 2025-03-26 19:52:51 +00:00 by Vectornaut · 3 comments
Member

Goal

The continuous integration workflow set up in pull request #75 verifies three things:

  • The application builds without errors or warnings.
  • The automated tests pass, and they build without warnings.
  • The examples build and run without errors or warnings.

It's useful to do these checks as separate jobs, because it makes the continuous integration report more granular. During local development, however, it would be nice to have a convenient way to run all three checks together.

Implementation ideas

If we give our examples the #[test] attribute, but ignore them unless a certain feature flag is set, we should be able to run the examples alongside the automated tests by calling

cargo test --examples --feature [whatever flag name we choose]
## Goal The continuous integration workflow set up in pull request #75 verifies three things: - The application builds without errors or warnings. - The automated tests pass, and they build without warnings. - The examples build and run without errors or warnings. It's useful to do these checks as separate jobs, because it makes the continuous integration report more granular. During local development, however, it would be nice to have a convenient way to run all three checks together. ## Implementation ideas If we [give](https://internals.rust-lang.org/t/examples-and-tests/14347/9) our examples the `#[test]` attribute, but [ignore](https://stackoverflow.com/a/48585979) them unless a certain feature flag is set, we should be able to run the examples alongside the automated tests by calling ``` cargo test --examples --feature [whatever flag name we choose] ```
Vectornaut added the
enhancement
prospective
labels 2025-03-26 19:52:51 +00:00
Owner

I am presuming this scheme has no WASM-bundle footprint when compiled for deployment. If so, sounds perfectly reasonable to me.

I am presuming this scheme has no WASM-bundle footprint when compiled for deployment. If so, sounds perfectly reasonable to me.
Vectornaut removed the
prospective
label 2025-04-09 02:07:52 +00:00
Author
Member

I am presuming this scheme has no WASM-bundle footprint when compiled for deployment.

That's right. If I've set things up right, tests and examples are conditionally compiled, so they won't affect the outcome of a release build.

> I am presuming this scheme has no WASM-bundle footprint when compiled for deployment. That's right. If I've set things up right, tests and examples are conditionally compiled, so they won't affect the outcome of a release build.
Vectornaut added the
prospective
label 2025-04-09 19:25:51 +00:00
Author
Member

During review of #75, we decided to bundle all three checks together under cargo test, both in continuous integration and during local development. We can get granular information about failures by looking at the test report. On Forgejo, the test report is a bit buried, but that shouldn't be a big deal, because we'll establish a routine of running CI locally before pushing to the server. During a local CI run, the test report is easy to see.

During review of #75, we decided to bundle all three checks together under `cargo test`, both in continuous integration and during local development. We can get granular information about failures by looking at the test report. On Forgejo, the test report is a bit buried, but that shouldn't be a big deal, because we'll establish a routine of running CI locally before pushing to the server. During a local CI run, the test report is easy to see.
Sign in to join this conversation.
No description provided.