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 (Mini/Mamba)forge #133

Merged
merged 12 commits into from
Dec 29, 2020
91 changes: 91 additions & 0 deletions .github/workflows/example-10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "Example 10: Miniforge, etc"

on:
pull_request:
branches:
- "*"
push:
branches:
- "master"
schedule:
# Note that cronjobs run on master/main by default
- cron: "0 0 * * *"

jobs:
example-10-miniforge:
# prevent cronjobs from running on forks
if:
(github.event_name == 'schedule' && github.repository ==
'conda-incubator/setup-miniconda') || (github.event_name != 'schedule')
name: Ex10 (${{ matrix.os }}, Miniforge)
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos", "windows"]
include:
- os: windows
miniforge-version: 4.9.2-4
steps:
- uses: actions/checkout@v2
- uses: ./
id: setup-miniconda
with:
environment-file: etc/example-environment.yml
miniforge-variant: Miniforge3
miniforge-version: ${{ matrix.miniforge-version }}
- run: |
conda info
conda list
python -VV
printenv | sort

example-10-mambaforge:
# prevent cronjobs from running on forks
if:
(github.event_name == 'schedule' && github.repository ==
'conda-incubator/setup-miniconda') || (github.event_name != 'schedule')
name: Ex10 (${{ matrix.os }}, Mambaforge)
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos", "windows"]
include:
# should use mamba 0.7.4 to upgrade to mamba 0.7.6
- os: ubuntu
environment-file: etc/example-environment-no-name.yml
miniforge-variant: Mambaforge
miniforge-version: 4.9.2-2
mamba-version: 0.7.6
python-version: 3.6
- os: macos
environment-file: etc/example-empty-channels-environment.yml
miniforge-variant: Mambaforge-pypy3
- os: windows
environment-file: etc/example-explicit.Windows.conda.lock
condarc-file: etc/example-condarc.yml
miniforge-variant: Mambaforge
steps:
- uses: actions/checkout@v2
- uses: ./
id: setup-miniconda
with:
condarc-file: ${{ matrix.condarc-file }}
environment-file: ${{ matrix.environment-file }}
miniforge-variant: ${{ matrix.miniforge-variant }}
miniforge-version: ${{ matrix.miniforge-version }}
mamba-version: ${{ matrix.mamba-version }}
use-mamba: true
python-version: ${{ matrix.python-version }}
- run: |
mamba info
mamba list
python -VV
printenv | sort
79 changes: 76 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,12 @@ Any installer created with [constructor](https://github.com/conda/constructor)
which includes `conda` can be used in place of Miniconda. For example,
[conda-forge](https://conda-forge.org/) maintains additional builds of
[miniforge](https://github.com/conda-forge/miniforge/releases) for platforms not
yet supported by Miniconda.
yet supported by Miniconda. For more, see [Example 10](#example-10-miniforge).

> Note: Installer downloads are cached based on their full URL: adding some
non-functional salt to the URL will prevent this behavior, e.g. `#${{ github.run_number }}`
> Notes:
> - Installer downloads are cached based on their full URL: adding some
> non-functional salt to the URL will prevent this behavior, e.g.
> `#${{ github.run_number }}`

```yaml
jobs:
Expand Down Expand Up @@ -278,6 +280,11 @@ Experimental! Use `mamba` to handle conda installs in a faster way.
you specify `conda-forge` as part of the channels, ideally with the highest
priority.

> Notes:
> - If a [custom installer](#example-5-custom-installer) provides `mamba`, it
> can be prioritized wherever possible (including installing `mamba-version`)
> with `use-mamba: true`.

```yaml
jobs:
example-6:
Expand Down Expand Up @@ -350,6 +357,72 @@ jobs:
printenv | sort
```

### Example 10: Miniforge

[Miniforge](https://github.com/conda-forge/miniforge) provides a number of
alternatives to Miniconda, built from the ground up with `conda-forge` packages
and with only `conda-forge` in its default channels.

```yaml
jobs:
example-10-miniforge:
name: Ex10 (${{ matrix.os }}, Miniforge)
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu", "macos", "windows"]
include:
- os: windows
miniforge-version: 4.9.2-4
steps:
- uses: actions/checkout@v2
- uses: ./
id: setup-miniconda
with:
environment-file: etc/example-environment.yml
miniforge-variant: Miniforge3
miniforge-version: ${{ matrix.miniforge-version }}
```

In addition to `Miniforge3` with `conda` and `CPython` for each
of its many supported platforms and architectures, additional variants including
`Mambaforge` (which comes pre-installed `mamba` in addition to `conda` on all platforms)
and `Miniforge-pypy3`/`Mamabaforge-pypy3` (which replace `CPython` with `pypy3`
on Linux/MacOs) are available. The specific version can also be overridden.

```yaml
jobs:
example-10-mambaforge:
name: Ex10 (${{ matrix.os }}, Mambaforge)
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos", "windows"]
include:
- os: ubuntu
environment-file: etc/example-environment-no-name.yml
miniforge-variant: Mambaforge
miniforge-version: 4.9.2-4
- os: macos
environment-file: etc/example-empty-channels-environment.yml
miniforge-variant: Mambaforge-pypy3
- os: windows
environment-file: etc/example-explicit.Windows.conda.lock
condarc-file: etc/example-condarc.yml
miniforge-variant: Mambaforge
steps:
- uses: actions/checkout@v2
- uses: ./
id: setup-miniconda
with:
condarc-file: ${{ matrix.condarc-file }}
environment-file: ${{ matrix.environment-file }}
miniforge-variant: ${{ matrix.miniforge-variant }}
miniforge-version: ${{ matrix.miniforge-version }}
use-mamba: true
```

## Caching

If you want to enable package caching for conda you can use the
Expand Down
28 changes: 27 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,31 @@ inputs:
default: ""
miniconda-version:
description:
"If provided, this version of miniconda will be downloaded and installed.
"If provided, this version of Miniconda3 will be downloaded and installed.
Visit https://repo.continuum.io/miniconda/ for more information on
available versions."
required: false
default: ""
miniforge-variant:
description:
"If provided, this variant of Miniforge will be downloaded and installed.
Currently-known values:
- Miniforge3
- Miniforge-pypy3
- Mambaforge
- Mambaforge-pypy3
Visit https://github.com/conda-forge/miniforge/releases/ for more information
on available variants"
required: false
default: ""
miniforge-version:
description:
"If provided, this version of the given Miniforge variant will be downloaded
and installed instead of the latest.
Visit https://github.com/conda-forge/miniforge/releases/ for more information
on available versions"
required: false
default: ""
conda-version:
description:
'Specific version of Conda to install after miniconda is located or
Expand Down Expand Up @@ -187,6 +207,12 @@ inputs:
use "*" or a "x.y" version string.'
required: false
default: ""
use-mamba:
description:
'Experimental. Use mamba as soon as available (either as provided by
`mamba-in-installer` or installation by `mamba-version`)'
required: false
default: ""
architecture:
description:
'Architecture of Miniconda that should be installed. Available options on
Expand Down
19 changes: 18 additions & 1 deletion dist/delete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PYTHON_SPEC = exports.WIN_PERMS_FOLDERS = exports.PROFILES = exports.ENV_VAR_CONDA_PKGS = exports.CONDA_CACHE_FOLDER = exports.CONDARC_PATH = exports.BOOTSTRAP_CONDARC = exports.FORCED_ERRORS = exports.IGNORED_WARNINGS = exports.KNOWN_EXTENSIONS = exports.BASE_ENV_NAMES = exports.OS_NAMES = exports.ARCHITECTURES = exports.MINICONDA_BASE_URL = exports.IS_UNIX = exports.IS_LINUX = exports.IS_MAC = exports.IS_WINDOWS = exports.MINICONDA_DIR_PATH = void 0;
exports.PYTHON_SPEC = exports.WIN_PERMS_FOLDERS = exports.PROFILES = exports.ENV_VAR_CONDA_PKGS = exports.CONDA_CACHE_FOLDER = exports.CONDARC_PATH = exports.BOOTSTRAP_CONDARC = exports.FORCED_ERRORS = exports.IGNORED_WARNINGS = exports.MAMBA_SUBCOMMANDS = exports.KNOWN_EXTENSIONS = exports.BASE_ENV_NAMES = exports.MINIFORGE_URL_PREFIX = exports.MINIFORGE_RELEASE_JSON = exports.MINIFORGE_INDEX_URL = exports.OS_NAMES = exports.ARCHITECTURES = exports.MINICONDA_BASE_URL = exports.IS_UNIX = exports.IS_LINUX = exports.IS_MAC = exports.IS_WINDOWS = exports.MINICONDA_DIR_PATH = void 0;
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
//-----------------------------------------------------------------------
Expand All @@ -1184,12 +1184,29 @@ exports.OS_NAMES = {
darwin: "MacOSX",
linux: "Linux",
};
/** API endpoint for Miniforge releases */
exports.MINIFORGE_INDEX_URL = `https://api.github.com/repos/conda-forge/miniforge/releases?per_page=100`;
/** */
exports.MINIFORGE_RELEASE_JSON = "miniforge-releases.json";
/** Common download prefix */
exports.MINIFORGE_URL_PREFIX = "https://github.com/conda-forge/miniforge/releases/download";
/** Names for a conda `base` env */
exports.BASE_ENV_NAMES = ["root", "base", ""];
/**
* Known extensions for `constructor`-generated installers supported
*/
exports.KNOWN_EXTENSIONS = [".exe", ".sh"];
/** As of mamba 0.7.6, only these top-level commands are supported */
exports.MAMBA_SUBCOMMANDS = [
"clean",
"create",
"env",
"info",
"install",
"list",
"run",
"search",
];
/**
* Errors that are always probably spurious
*/
Expand Down
Loading