Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .ci/micromamba/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the folder didn't already exist, I get errors:

[micromamba] Changing permissions for previous environment [dev]...
chmod: cannot access '/path/to/repo/.ci/micromamba/micromamba/envs/dev': No such file or directory

This is likely just cosmetic, but inelegant.


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
Expand Down
19 changes: 19 additions & 0 deletions .ci/micromamba/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
Comment thread
Szelethus marked this conversation as resolved.
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
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, we forgot to mention run_tests.sh in that file. It would be elegant to either create a link to this documentation file, or just mention the script there as well.

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!
Loading