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

Default to using conda-forge #100

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .github/workflows/resources/channels_condarc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
channels: [free]
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
with:
environment-file: false

- run: micromamba info

- name: install mamba
uses: ./

Expand Down
43 changes: 29 additions & 14 deletions .github/workflows/test_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ jobs:
steps:
- uses: actions/checkout@v3

# Download only
- name: install mamba
uses: ./
with:
environment-file: false
environment-name: nofile
- run: |
micromamba info | grep -qv nofile
micromamba info | grep -q conda-forge

- name: install mamba
uses: ./
Expand Down Expand Up @@ -104,6 +108,9 @@ jobs:
fail-fast: false
matrix:
environment-file: [false, environment.yml]
condarc-file: ['', .github/workflows/resources/channels_condarc]
condarc-options: ['', 'channels: [pytorch]']
channels: ['', 'main']
steps:
- uses: actions/checkout@v3

Expand All @@ -113,22 +120,30 @@ jobs:
environment-file: ${{ matrix.environment-file }}
environment-name: test-channels
extra-specs: |
xtensor
channels: conda-forge,blah
${{ matrix.condarc-options && 'cpuonly' || 'zlib' }}
channels: ${{ matrix.channels }}
condarc-file: ${{ matrix.condarc-file }}
condarc-options: ${{ matrix.condarc-options }}
- name: check channels are correct
run: |
CHANNEL_OPT=$(micromamba config get channels)
echo $CHANNEL_OPT
if [[ "$CHANNEL_OPT" != *"conda-forge"* ]]; then
exit 1;
fi
if [[ "$CHANNEL_OPT" != *"blah"* ]]; then
exit 1;
fi
if [[ "${{ matrix.environment-file }}" != "false" ]]; then
if [[ "$CHANNEL_OPT" != *"defaults"* ]]; then
exit 1;
fi
micromamba info > /tmp/info
cat /tmp/info
set -x
if test "${{ matrix.environment-file }}${{ matrix.condarc-file }}${{ matrix.condarc-options }}${{ matrix.channels }}" = false; then
# extra-specs only
grep -q conda-forge /tmp/info
! grep -qE 'defaults|free|main|pytorch' /tmp/info
elif test -n "${{ matrix.condarc-options }}"; then
grep -q pytorch /tmp/info
! grep -qE 'conda-forge|defaults|free|main' /tmp/info
elif test -n "${{ matrix.channels }}"; then
grep -q main /tmp/info
! grep -qE 'conda-forge|defaults|free|pytorch' /tmp/info
elif test -n "${{ matrix.condarc-file }}"; then
grep -q free /tmp/info
! grep -qE 'conda-forge|defaults|main|pytorch' /tmp/info
else
! grep -qE 'conda-forge|defaults|free|main|pytorch' /tmp/info
fi

test_environment_without_name:
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ They are preinstalled in the default GitHub Actions environments.

### `environment-file`

Required. Path to the `environment.yml` or `.lock` file for the Conda environment OR `false`. If `false`, only *extra-specs* will be considered and you should provide *channels*. If both *environment-file* and *extra-specs* are empty, no environment will be created (only `micromamba` will be installed). See the [Conda documentation](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-from-an-environment-yml-file) for more information.
Required. Path to the `environment.yml` or `.lock` file for the Conda environment OR `false`. If `false`, only *extra-specs* will be considered. If both *environment-file* and *extra-specs* are empty, no environment will be created (only `micromamba` will be installed). See the [Conda documentation](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-from-an-environment-yml-file) for more information.

Default value: `environment.yml`

Expand Down Expand Up @@ -46,17 +46,15 @@ are available.

### `channels`

Comma separated list of channels to use in order of priority (eg., `conda-forge,my-private-channel`)
DEPRECATED, alias for `condarc-options: channels:`.

### `condarc-file`

Path to a `.condarc` file to use. See the [Conda documentation](https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/) for more information.

### `channel-priority`

Channel priority to use. One of `"strict"`, `"flexible"`, and `"disabled"`. See https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html#strict-channel-priority for more information.

Default value: `strict`
DEPRECATED, alias for `condarc-options: channel_priority:`. Channel priority to use. One of `"strict"`, `"flexible"`, and `"disabled"`. See https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html#strict-channel-priority for more information.

### `cache-downloads`

Expand Down Expand Up @@ -88,14 +86,17 @@ Default value: `https://micro.mamba.pm/api/micromamba`

### `condarc-options`

More options to append to `.condarc`. Must be a string of valid YAML:
More options to prepend to `.condarc`. Must be a string of valid YAML:

```yaml
condarc-options: |
proxy_servers:
http: ...
```

Defaults to `channel_priority: strict`, and an additional `channels: conda-forge`
if `environment-file` is `false` and no `channels` are given in `condarc-file` and `condarc-options`.

### `post-deinit`

Attempt to undo any modifications done to `.bashrc` etc. in the post action of the workflow.
Expand Down
12 changes: 7 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
description: >-
Required.
Path to the `environment.yml` or `.lock` file for the Conda environment OR `false`.
If `false`, only *extra-specs* will be considered and you should provide *channels*.
If `false`, only *extra-specs* will be considered.
If both *environment-file* and *extra-specs* are empty,
no environment will be created (only `micromamba` will be installed).
See the [Conda documentation](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-from-an-environment-yml-file)
Expand Down Expand Up @@ -44,18 +44,17 @@ inputs:
are available.
channels:
description: >-
Comma separated list of channels to use in order of priority (eg., `conda-forge,my-private-channel`)
DEPRECATED, alias for `condarc-options: channels:`.
condarc-file:
description: >-
Path to a `.condarc` file to use. See the [Conda documentation](https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/)
for more information.
channel-priority:
description: >-
DEPRECATED, alias for `condarc-options: channel_priority:`.
Channel priority to use. One of `"strict"`, `"flexible"`, and `"disabled"`.
See https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html#strict-channel-priority
for more information.
required: true
default: strict

# Caching options
cache-downloads:
Expand Down Expand Up @@ -102,13 +101,16 @@ inputs:
default: https://micro.mamba.pm/api/micromamba
condarc-options:
description: |-
More options to append to `.condarc`. Must be a string of valid YAML:
More options to prepend to `.condarc`. Must be a string of valid YAML:

```yaml
condarc-options: |
proxy_servers:
http: ...
```

Defaults to `channel_priority: strict`, and an additional `channels: conda-forge`
if `environment-file` is `false` and no `channels` are given in `condarc-file` and `condarc-options`.
post-deinit:
description: |-
Attempt to undo any modifications done to `.bashrc` etc. in the post action of the workflow.
Expand Down
Loading