Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to configure run_tests via environment variables #197

Open
anthrotype opened this issue Sep 5, 2018 · 3 comments
Open

Allow to configure run_tests via environment variables #197

anthrotype opened this issue Sep 5, 2018 · 3 comments

Comments

@anthrotype
Copy link
Contributor

Currently it isn't possible to set environment variables in the .travis.yml and have those propagate down to the install_run phase of multibuild, at least for the linux platform.

One use case is for setting the TOXENV variable in the Travis build matrix, and have the run_tests function run the corresponding tox environment.

The workaround I'm using now is to define the tox environment inside run_tests function based on the value of MB_PYTHON_VERSION, which is the only variable that trickles down from the Travis env down to the matthewbrett/trusty docker container where the linux run_tests is being run.

One way to do this could be to reuse the env_vars.sh trick that multibuild already uses to pass environment variables to the dockerized manylinux build stage.
The install_run function in travis_linux_steps.sh could pass -e ENV_VARS_PATH="$ENV_VARS_PATH" option to the docker run command, and then docker_test_wrap.sh could perform a source $ENV_VARS_PATH.

What do you think?

@matthew-brett
Copy link
Collaborator

Sounds reasonable, yes.

@anthrotype
Copy link
Contributor Author

anthrotype commented Sep 5, 2018

this seems related to https://github.com/matthew-brett/multibuild/issues/183, although there the OP wants to conditionally set the variable for the build phase, whereas I want to do it for the test phase.

I imagine that if I wish to set the TOXENV in the Travis build env and have it available in the run_tests function I would need to dynamically create an env_vars.sh file based on some other variables in the current Travis environment.

I wonder... if this "inherit the whole Travis environment from within the docker build and test run" could actually be a feature of multibuild. If you think about it, the macos builds already work like that, because of the mere fact that they don't run in an isolated docker container.
It's only the linux builds that pose this problem. 🤔

@matthew-brett
Copy link
Collaborator

I did think about that, but it's not easy to work out which vars should go in, and which are coincidental to the bash shell running on travis.

@radarhere radarhere changed the title allow to configure run_tests via environment variables Allow to configure run_tests via environment variables Jan 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants