Skip to content

Commit

Permalink
Merge branch 'main' into pavelzw-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jjerphan authored Nov 25, 2024
2 parents 3111234 + 1d8f116 commit cc186eb
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 1,875 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
TAG_NAME: v${{ steps.version-metadata.outputs.newVersion }}
- name: Create release
if: steps.version-metadata.outputs.changed == 'true'
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8
with:
generate_release_notes: true
tag_name: v${{ steps.version-metadata.outputs.newVersion }}
Expand Down
56 changes: 33 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ GitHub Action to set up the [micromamba](https://github.com/mamba-org/mamba#micr
## Usage

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '1.5.6-0' # any version from https://github.com/mamba-org/micromamba-releases
environment-file: environment.yml
init-shell: >-
bash
Expand All @@ -31,6 +30,17 @@ GitHub Action to set up the [micromamba](https://github.com/mamba-org/mamba#micr
To see all available input arguments, see the [`action.yml`](action.yml) file.

### Micromamba version

You can specify the version of micromamba to be installed using the `micromamba-version` input.

```yml
- uses: mamba-org/setup-micromamba@v1
with:
# Any version from https://github.com/mamba-org/micromamba-releases
micromamba-version: '1.5.6-0'
```

### Environment creation

`setup-micromamba` allows you to create micromamba environments from an environment file or from a list of packages.
Expand All @@ -44,7 +54,7 @@ This will automatically activate the environment when the shell is started.
#### Create environment from environment file

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
```
Expand All @@ -55,7 +65,7 @@ Micromamba supports the `conda-lock` [unified lockfile format](https://conda.git
Because `setup-micromamba` requires an environment name to be specified, config might look like this:

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: conda-lock.yml
environment-name: ci
Expand All @@ -69,7 +79,7 @@ Because `setup-micromamba` requires an environment name to be specified, config
You can specify extra environment specs using the `create-args` input.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
# the create command looks like this:
# `micromamba create -n test-env python=3.10 numpy`
Expand All @@ -84,11 +94,11 @@ You can specify extra environment specs using the `create-args` input.
You can specify custom arguments for the `micromamba create` command using the `create-args` input. See `micromamba create --help` for more information.

> [!NOTE]
> This is the same argument as in the [previous example](#create-environment-from-environment-specs) but with different semantics.
> This is the same argument as in the [previous example](#create-environment-from-environment-specs) but with different semantics.
> This is because internally, `setup-micromamba` uses the `micromamba create` command to create the environment from the environment file and there, extra specs are specified by adding them as extra arguments to the `micromamba create` command.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
create-args: -v
Expand All @@ -102,7 +112,7 @@ By default, it will create shell initialization scripts for `bash`.
If you want to customize this, you can use the `init-shell` input.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
init-shell: bash
```
Expand All @@ -112,7 +122,7 @@ In case you don't want to initialize your shell, you can set `init-shell` to `no
You can also specify multiple shells by separating them with a space (or using the `>-` YAML block scalar)

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
init-shell: >-
bash
Expand All @@ -137,7 +147,7 @@ You can set this behavior by specifying the `generate-run-shell` input (defaults
> Only available on macOS and Linux.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
generate-run-shell: true
environment-file: environment.yml
Expand All @@ -161,14 +171,14 @@ The action will also set the `CONDARC` environment variable to point to this fil
If nothing is specified, `setup-micromamba` will create a `.condarc` next to the micromamba binary with `conda-forge` as the only channel.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
condarc-file: /path/to/.condarc
```

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
condarc: |
Expand All @@ -189,7 +199,7 @@ If `cache-environment` is set to `true` and `cache-environment-key` is not speci
> `setup-micromamba` will append a hash of the environment file and the `custom-args` as well as the environment name and OS to the cache key.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
# only cache environment
Expand All @@ -198,7 +208,7 @@ If `cache-environment` is set to `true` and `cache-environment-key` is not speci
```

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
# persist only for runs on this commit.
Expand All @@ -210,7 +220,7 @@ If `cache-environment` is set to `true` and `cache-environment-key` is not speci
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
# persist on the same day.
Expand All @@ -230,7 +240,7 @@ The first one is the debug logging of the action itself.
This can be enabled by running the action with the `ACTIONS_STEP_DEBUG` environment variable set to `true`.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba2v2
env:
ACTIONS_STEP_DEBUG: true
```
Expand All @@ -248,7 +258,7 @@ The second type is the debug logging of the micromamba executable.
This can be specified by setting the `log-level` input.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
# supports off, critical, error, warning, info, debug, trace
Expand Down Expand Up @@ -276,7 +286,7 @@ There is a total of 4 options:
If nothing is specified, `setup-micromamba` will default to `shell-init`.

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
post-cleanup: environment
Expand All @@ -287,7 +297,7 @@ If nothing is specified, `setup-micromamba` will default to `shell-init`.
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
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
# ${{ runner.temp }}\Scripts\micromamba.exe on Windows
Expand All @@ -312,7 +322,7 @@ You can control the download behavior of micromamba with the options `download-m
| Yes | true | set | Download to specified path |

```yml
- uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: environment.yml
download-micromamba: false
Expand All @@ -333,7 +343,7 @@ Due to a [security limitation of GitHub Actions](https://docs.github.com/en/acti
any caches created on a branch will not be available on the main/parent branch
after merging. This also applies to PRs.

In contrast, branches *can* use a cache created on the main/parent branch.
In contrast, branches *can* use a cache created on the main/parent branch.

See also [this thread](https://github.com/mamba-org/provision-with-micromamba/issues/42#issuecomment-1062007161).

Expand Down Expand Up @@ -378,8 +388,8 @@ Find the reasons below (taken from [setup-miniconda](https://github.com/conda-in
disabled execution of `Command Processor/Autorun` Windows registry keys, which
is what `micromamba shell init cmd.exe` sets.

For further information, see
[`jobs.<job_id>.steps[*].shell`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell)
For further information, see
[`jobs.<job_id>.steps[*].shell`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell)
and [this thread](https://github.com/orgs/community/discussions/25061).

## Development
Expand Down
Loading

0 comments on commit cc186eb

Please sign in to comment.