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

Add download-micromamba #179

Merged
merged 3 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,42 @@ jobs:
which micromamba-shell | grep /home/runner/micromamba-bin/micromamba-shell
shell: bash -el {0}

use-micromamba-from-path:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download micromamba
run: |
curl -Ls https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-linux-64 -o /usr/local/bin/micromamba
chmod +x /usr/local/bin/micromamba
which micromamba
- uses: ./
with:
environment-file: test/environment.yml
download-micromamba: false
- run: |
micromamba info | grep -q "environment : env-name"
shell: bash -elo pipefail {0}

no-download-with-custom-path:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download micromamba
run: |
mkdir -p "$HOME/not-on-path/bin"
curl -Ls https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-linux-64 -o "$HOME/not-on-path/bin/micromamba"
chmod +x "$HOME/not-on-path/bin/micromamba"
- uses: ./
with:
environment-file: test/environment.yml
download-micromamba: false
micromamba-binary-path: ~/not-on-path/bin/micromamba
- run: |
micromamba info | grep -q "environment : env-name"
which micromamba | grep not-on-path/bin
shell: bash -elo pipefail {0}

# not properly testable
# https://github.com/actions/runner/issues/2347
# https://github.com/orgs/community/discussions/15452
Expand Down
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,17 @@ This can be specified by setting the `log-level` input.

If nothing is specified, `setup-micromamba` will default to `warning` or `debug` depending on if [debug logging is enabled for the action](#debug-logging-of-the-action).

### Post action cleanup
### Self-hosted runners

On self hosted runners, it may happen that some files are persisted between jobs.
On self-hosted runners, it may happen that some files are persisted between jobs.
This can lead to problems when the next job is run.
To avoid this, you can use the `post-cleanup` input to specify the post cleanup behavior of the action (i.e., what happens _after_ all your commands have been executed).

#### Post-action cleanup

To avoid persistence between jobs, you can use the `post-cleanup` input to specify the post cleanup behavior of the action (i.e., what happens _after_ all your commands have been executed).

There is a total of 4 options:

- `none`: No cleanup is performed.
- `shell-init`: The shell initialization files are removed by executing `micromamba shell deinit -s <shell>`.
- `environment`: Shell initialization files and the installed environment are removed.
Expand All @@ -278,6 +282,30 @@ If nothing is specified, `setup-micromamba` will default to `shell-init`.
post-cleanup: environment
```

#### Specify the path of the micromamba binary

You also might want to alter the default micromamba installation location to a temporary location. You can use `micromamba-binary-path: ${{ runner.temp }}/bin/micromamba` to do this.

```yml
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
# ${{ runner.temp }}\Scripts\micromamba.exe on Windows
micromamba-binary-path: ${{ runner.temp }}/bin/micromamba
```

You can also use a pre-installed micromamba binary by setting `micromamba-binary-path` to the path of the binary and specifying `download-micromamba: false`.

```yml
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
download-micromamba: false
# you don't need to specify this if micromamba is already on PATH
micromamba-binary-path: /usr/local/bin/micromamba
generate-run-shell: false # this would generate a file next to the micromamba binary
```

## More examples

If you want to see more examples, you can take a look at the [GitHub Workflows of this repository](.github/workflows/).
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ inputs:
micromamba-url:
description: |
URL to download micromamba from.
download-micromamba:
description: |
If you already have micromamba installed, you can set this to `false`.
pavelzw marked this conversation as resolved.
Show resolved Hide resolved
init-shell:
description: |
Which shells to initialize micromamba in.
Expand Down
Loading
Loading