Canop / Canop/bacon

[feature] Add pre/post commands to custom jobs

Open
#367 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.4k
Forks
126
Avg merge
2d 1h
Merged PRs (30d)
7

Description

Tangentially related to running multiple commands (see #165) there is another issue that is tricky to work around: needing setup and/or teardown actions before running a test.

I have a project using Rust and Maturin to build a Python module, which can then be tested with Pytest. Just running `pytest` with some `env` vars set is okay to run tests but there are two issues:

* before running tests at all, some initial setup of a venv needs to be done. This setup should *NOT* be run every time the watch triggers a test run update, only once.
* the only thing the watch accomplishes is catching changes to the test, with the build step involved (in my case `maturin develop` also needs to be triggered if the Rust code changes.

The second of these can be handled with two work-arounds (either putting it in a script to run before pytest every time (slow but simple) or running it in a watch on the side in addition to bacon (faster but more complex)), but the first one basically means `bacon` can't be launched directly, it needs to be launched from a wrapper that does the setup for it.

I would imagine it is possible to have `bacon` handle both of these cases as well many more by introducing one or two new features:

* A pre/post (setup/teardown) command could be configured in addition to `env` keys that would be executed once before (or after) the test watch loop is entered.
* A during (background) command could be launched out of sight that is expected to stay running while the bacon test interface is active, then killed off when it is done.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.