How to execute additional code before runtests.jl?

I’m trying to solve How to detect whether the build (compiler options) is a production build. I think the right solution is to introduce a global boolean constant whose value would be determined by the user (most often CI) so that it would be available within test/runtests.jl. This could be solved with Preferences.jl, however that seems unnecessarily complicated as it involves TOML files on disk.

Is there a way to define a statement like const flag = true that would execute before test/runtests.jl. It should be easy to use from CI.

Use an environment variable? Most CI platforms already set the CI env variable for you.


Could you just use a command line argument for that?

Edit: I think @cjdoris suggestion makes more sense.

1 Like