Skip to content

Commit

Permalink
More options (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashaag authored Jun 15, 2022
1 parent d77ce72 commit 37cc095
Show file tree
Hide file tree
Showing 8 changed files with 58,222 additions and 64 deletions.
87 changes: 79 additions & 8 deletions .github/workflows/test_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
- main
pull_request: null

defaults:
run:
shell: bash -el {0}

jobs:
test_enviroment_file_and_enviroment_name:
name: Test environment-file, environment-name, extra-specs, log-level
Expand Down Expand Up @@ -43,7 +47,6 @@ jobs:
if: runner.os == 'Windows'

- name: run python in bash
shell: bash -l {0}
run: |
which micromamba
micromamba info
Expand All @@ -58,7 +61,6 @@ jobs:
if: runner.os == 'Windows'

- name: test environment name in bash
shell: bash -l {0}
run: |
python -c "import os; env = os.environ['CONDA_PREFIX'].split('/')[-1]; assert env == 'myenv'"
if: runner.os != 'Windows'
Expand All @@ -71,7 +73,6 @@ jobs:
if: runner.os == 'Windows'

- name: check python version in bash
shell: bash -l {0}
run: |
python --version
python -c "import platform; assert platform.python_version() == '3.8.8'"
Expand All @@ -85,7 +86,6 @@ jobs:
if: runner.os == 'Windows'

- name: check pytest version in bash
shell: bash -l {0}
run: |
pytest --version
python -c "import pytest; assert pytest.__version__.startswith(str(${{ matrix.pytest }}))"
Expand Down Expand Up @@ -135,10 +135,6 @@ jobs:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -180,3 +176,78 @@ jobs:
if micromamba list | grep -q xtensor; then exit 1; fi
if micromamba list | grep -q cmake; then exit 1; fi
if ! micromamba list | grep -q ninja; then exit 1; fi
test_channel_priority:
name: Test channel-priority
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v2

- name: install mamba
uses: ./
with:
channel-priority: flexible
environment-file: environment.yml

- name: test
run: |
cat ~/.condarc
grep "channel_priority: flexible" ~/.condarc
test_condarc_file:
name: Test condarc-file
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v2

- name: create .condarc
run: |
echo "# sentinel" > mycondarc
- name: install mamba
uses: ./
with:
environment-file: environment.yml
condarc-file: mycondarc

- name: test
run: |
cat ~/.condarc
grep "# sentinel" ~/.condarc
test_condarc_options:
name: Test condarc-options
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v2

- name: install mamba
uses: ./
with:
environment-file: environment.yml
condarc-options: |
verify_ssl: false
proxy_servers:
xxx: https://example.com
create_default_packages:
- pip >1
- name: test
run: |
cat ~/.condarc
grep "verify_ssl: false" ~/.condarc
grep "xxx: " ~/.condarc
grep " - pip >1" ~/.condarc
64 changes: 54 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,87 @@ They are preinstalled in the default GitHub Actions environments.

### `environment-file`

The environment.yml or .lock file for the conda environment. If 'false', no enviroment will be created (only Micromamba will be installed) and you should provide 'channels'.
Required. The 'environment.yml' or '.lock' file for the Conda environment. If 'false', only `extra-specs` will be considered and you should provide 'channels'. If both 'environment-file' and 'extra-specs' are empty, no enviroment 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"

### `environment-name`

(Optional) The name of the conda environment (defaults to name from the environment.yml file). Required if 'environment-file' is a '.lock' file or 'false'.
The name of the Conda environment. Defaults to name from the environment.yml file. Required if 'environment-file' is a '.lock' file or 'false'.

### `micromamba-version`

(Optional) Version of micromamba to use, eg. '0.20' (default 'latest').
Version of micromamba to use, eg. '0.20'. See https://github.com/mamba-org/mamba/releases/ for a list of releases.

Default value: "latest"

### `extra-specs`

(Optional) Additional specifications (packages) to install. Pretty useful when using matrix builds to pin versions of a test/run dependency. For multiple packages, use multiline syntax (see examples). Note that selectors (e.g. `sel(linux): my-linux-package`, `sel(osx): my-osx-package`, `sel(win): my-win-package`) are available.
Additional specifications (packages) to install.
Pretty useful when using matrix builds to pin versions of a test/run dependency.
For multiple packages, use multiline syntax:
```yaml
extra-specs: |
python=3.10
xtensor
```
Note that selectors
(e.g. `sel(linux): my-linux-package`, `sel(osx): my-osx-package`, `sel(win): my-win-package`)
are available.


### `channels`

(Optional) Comma separated list of channels to use in order of priority (eg., `conda-forge,my-private-channel`)
Comma separated list of channels to use in order of priority (eg., `conda-forge,my-private-channel`)

### `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"

### `cache-downloads`

(Optional) If 'true', cache downloaded packages across calls to the provision-with-micromamba action. Cache invalidation can be controlled using the 'cache-downloads-key' option.
If 'true', cache downloaded packages across calls to the provision-with-micromamba action. Cache invalidation can be controlled using the 'cache-downloads-key' option.

### `cache-downloads-key`

(Optional) Custom download cache key used with 'cache-downloads: true'. The default download cache key will invalidate the cache once per day.
Custom download cache key used with 'cache-downloads: true'. The default download cache key will invalidate the cache once per day.

### `cache-env`

(Optional) If 'true', cache installed environments across calls to the provision-with-micromamba action. Cache invalidation can be controlled using the 'cache-env-key' option.
If 'true', cache installed environments across calls to the provision-with-micromamba action. Cache invalidation can be controlled using the 'cache-env-key' option.

### `cache-env-key`

(Optional) Custom environment cache key used with 'cache-env: true'. With the default environment cache key, separate caches will be created for each operating system (eg., Linux) and platform (eg., x64) and day (eg., 2022-01-31), and the cache will be invalidated whenever the contents of 'environment-file' or 'extra-specs' change.
Custom environment cache key used with 'cache-env: true'. With the default environment cache key, separate caches will be created for each operating system (eg., Linux) and platform (eg., x64) and day (eg., 2022-01-31), and the cache will be invalidated whenever the contents of 'environment-file' or 'extra-specs' change.

### `log-level`

(Optional) Micromamba log level to use. One of "trace", "debug", "info", "warning", "error", "critical", "off".
Micromamba log level to use. One of "trace", "debug", "info", "warning", "error", "critical", "off".

Default value: "info"

### `installer-url`

Base URL to fetch Micromamba from. Files will be downloaded from `<base url>/<platform>/<version>`, eg. https://micro.mamba.pm/api/micromamba/linux-64/latest.

Default value: "https://micro.mamba.pm/api/micromamba"

### `condarc-options`

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

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


<!-- end generated -->

Expand Down
Loading

0 comments on commit 37cc095

Please sign in to comment.