dylint icon indicating copy to clipboard operation
dylint copied to clipboard

Convert GitHub workflow tests to Rust tests

Open smoelius opened this issue 2 years ago • 4 comments

Do more with Rust tests and less with Yaml/Bash.

The point is to make more tests runnable via cargo test (not to use Rust for Rust's sake).

Necessist uses this approach, e.g., for checking licenses and checking lockfiles.

The new tests should probably go in ci.rs.

smoelius avatar Mar 12 '23 12:03 smoelius

https://github.com/trailofbits/dylint/pull/1077 is a recent example of such a conversion. Here is a summary of its changes:

  • Installation of cargo-rdme was moved from the lint step to the test step: https://github.com/trailofbits/dylint/blob/879ba2626d28beabdc6c0ff0c482c81b20a54f61/.github/workflows/ci.yml#L144
  • Invocation of update_util_READMEs.sh was removed from the lint step.
  • update_util_READMEs.sh was removed altogether.
  • update_util_READMEs.sh's functionality was duplicated in a test. The bulk of the logic is in a closure that is passed to preserves_cleanliness: https://github.com/trailofbits/dylint/blob/879ba2626d28beabdc6c0ff0c482c81b20a54f61/cargo-dylint/tests/ci.rs#L125-L138

smoelius avatar Apr 27 '24 01:04 smoelius