Skip to content

Commit

Permalink
Add conda-solver option (#291)
Browse files Browse the repository at this point in the history
* Add conda-solver option

* add example

* Remove experimental warnings from mamba

* lint

* fix names

* add to ICondaConfig

* build

* Update dependencies and lint

* Update package json

* Build

---------

Co-authored-by: Gonzalo Peña-Castellanos <goanpeca@gmail.com>
Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 25, 2023
1 parent ce210e1 commit 8874247
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 8 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/example-12.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Example 12: Configure conda solver"

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

jobs:
example-12:
# prevent cronjobs from running on forks
if:
(github.event_name == 'schedule' && github.repository ==
'conda-incubator/setup-miniconda') || (github.event_name != 'schedule')
name: Ex12 (os=${{ matrix.os }} solver=${{ matrix.solver }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
solver: ["classic", "libmamba"]
os: ["ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v2
- uses: ./
id: setup-miniconda
continue-on-error: true
with:
auto-update-conda: true
conda-solver: ${{ matrix.solver }}
python-version: "3.9"
- name: Conda info
shell: bash -el {0}
run: conda info
- name: Conda list
shell: pwsh
run: conda list
- name: Environment
shell: bash -el {0}
run: printenv | sort
- name: Create an environment
shell: bash -el {0}
run: conda create -n unused --dry-run zlib
15 changes: 11 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,24 @@ inputs:
default: "true"
mamba-version:
description:
'Experimental. Use mamba (https://github.com/QuantStack/mamba) as a faster
drop-in replacement for conda installs. Disabled by default. To enable,
use "*" or a "x.y" version string.'
'Use mamba (https://github.com/QuantStack/mamba) as a faster drop-in
replacement for conda installs. Disabled by default. To enable, use "*" or
a "x.y" version string.'
required: false
default: ""
use-mamba:
description:
"Experimental. Use mamba as soon as available (either as provided by
"Use mamba as soon as available (either as provided by
`mamba-in-installer` or installation by `mamba-version`)"
required: false
default: ""
conda-solver:
description:
"Which conda solver plugin to use. Only applies to the `conda` client, not
`mamba`. Starting with Miniconda 23.5.2 and Miniforge 23.3.1, you can
choose between `classic` and `libmamba`."
required: false
default: "libmamba"
architecture:
description:
'Architecture of Miniconda that should be installed. Default is "x64". The
Expand Down
2 changes: 1 addition & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47111,7 +47111,6 @@ exports.updateMamba = {
label: "update mamba",
provides: (inputs, options) => __awaiter(void 0, void 0, void 0, function* () { return inputs.mambaVersion !== "" || options.mambaInInstaller; }),
toolPackages: (inputs, options) => __awaiter(void 0, void 0, void 0, function* () {
core.warning(`Mamba support is still experimental and can result in differently solved environments!`);
return {
tools: inputs.mambaVersion !== ""
? [utils.makeSpec("mamba", inputs.mambaVersion)]
Expand Down Expand Up @@ -48190,6 +48189,7 @@ function parseInputs() {
channels: core.getInput("channels"),
show_channel_urls: core.getInput("show-channel-urls"),
use_only_tar_bz2: core.getInput("use-only-tar-bz2"),
solver: core.getInput("conda-solver"),
// These are always set to avoid terminal issues
always_yes: "true",
changeps1: "false",
Expand Down
3 changes: 0 additions & 3 deletions src/base-tools/update-mamba.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ export const updateMamba: types.IToolProvider = {
provides: async (inputs, options) =>
inputs.mambaVersion !== "" || options.mambaInInstaller,
toolPackages: async (inputs, options) => {
core.warning(
`Mamba support is still experimental and can result in differently solved environments!`,
);
return {
tools:
inputs.mambaVersion !== ""
Expand Down
1 change: 1 addition & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export async function parseInputs(): Promise<types.IActionInputs> {
channels: core.getInput("channels"),
show_channel_urls: core.getInput("show-channel-urls"),
use_only_tar_bz2: core.getInput("use-only-tar-bz2"),
solver: core.getInput("conda-solver"),
// These are always set to avoid terminal issues
always_yes: "true",
changeps1: "false",
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export interface ICondaConfig {
use_only_tar_bz2: string;
always_yes: string;
changeps1: string;
solver: string;
}

/**
Expand Down

0 comments on commit 8874247

Please sign in to comment.