diff --git a/.ci/micromamba/init.sh b/.ci/micromamba/init.sh index 50c6d950..a225fb8d 100644 --- a/.ci/micromamba/init.sh +++ b/.ci/micromamba/init.sh @@ -69,9 +69,13 @@ if [[ "$VERBOSE" -ge 2 ]]; then micromamba info fi +# Make the leftover environment modifiable to allow micromamba to delete bazel cache folders during its setup +info "Changing permissions for previous environment [$ENV_NAME]..." +chmod -R +w $THIS_DIR/micromamba/envs/$ENV_NAME + +micromamba deactivate # Create environment info "Creating environment [$ENV_NAME]..." -micromamba deactivate micromamba create --file $THIS_DIR/$ENV_NAME.yaml --name $ENV_NAME --yes $MAMBA_VERBOSITY # micromamba config set env_prompt "[{name}] " micromamba activate $ENV_NAME diff --git a/.ci/micromamba/run_tests.sh b/.ci/micromamba/run_tests.sh new file mode 100755 index 00000000..8ec32a39 --- /dev/null +++ b/.ci/micromamba/run_tests.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +SCRIPT_DIR=$(dirname "$(realpath "$0")") +cd $SCRIPT_DIR + +echo "Initialize micromamba environment..." +source ./init.sh + +# Change directory to project root +cd ../../ + +echo "Running pylint..." +pylint . +echo "Running bazel test //..." +bazel test //... +echo "Running pytest ..." +pytest test + +echo "Exiting micromamba..." +micromamba deactivate diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17db874a..a17b810b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,4 +49,18 @@ test/test.sh | Functional and unit test runner Submitting a patch and testing ------- -Before submitting any changes please make sure all tests and checks are passed, pylint doesn't show warnings on new code, and fill out the Pull Request template. If you are a new contributor, and the template is confusing, feel free to submit the PR and we will help you iron it out! On how to run or add a new test, please see [test/README.md](test/README.md). +Before submitting any changes please make sure all tests and checks have passed inside the micromamba environment. + +To enable the Micromamba testing environment run `source .ci/micromamba/init.sh`. +For more information see `.ci/micromamba/README.md`. +You must run the following tests locally: +* `pylint .` +* `bazel test //...` +* `pytest test` + +To run all these test inside the micromamba environment automatically, run `.ci/micromamba/run_tests.sh`. + +On how to run or add a new test, please see [test/README.md](test/README.md). + + +Finally, fill out the Pull Request template. If you are a new contributor, and the template is confusing, feel free to submit the PR and we will help you iron it out!