From 8874247bd8ff54e8518c63dcb062a977bcc42172 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Sat, 25 Nov 2023 09:12:20 +0100 Subject: [PATCH] Add conda-solver option (#291) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Co-authored-by: Daniel Bast <2790401+dbast@users.noreply.github.com> --- .github/workflows/example-12.yml | 49 ++++++++++++++++++++++++++++++++ action.yml | 15 +++++++--- dist/setup/index.js | 2 +- src/base-tools/update-mamba.ts | 3 -- src/input.ts | 1 + src/types.ts | 1 + 6 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/example-12.yml diff --git a/.github/workflows/example-12.yml b/.github/workflows/example-12.yml new file mode 100644 index 00000000..081c67b6 --- /dev/null +++ b/.github/workflows/example-12.yml @@ -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 diff --git a/action.yml b/action.yml index b5e25ec5..05e32346 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/dist/setup/index.js b/dist/setup/index.js index e8ee5fb5..732a387b 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -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)] @@ -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", diff --git a/src/base-tools/update-mamba.ts b/src/base-tools/update-mamba.ts index bb2a3531..d866eec9 100644 --- a/src/base-tools/update-mamba.ts +++ b/src/base-tools/update-mamba.ts @@ -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 !== "" diff --git a/src/input.ts b/src/input.ts index 07fe2caa..26eb3d6a 100644 --- a/src/input.ts +++ b/src/input.ts @@ -110,6 +110,7 @@ export async function parseInputs(): Promise { 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", diff --git a/src/types.ts b/src/types.ts index ea674d9b..814451ce 100644 --- a/src/types.ts +++ b/src/types.ts @@ -65,6 +65,7 @@ export interface ICondaConfig { use_only_tar_bz2: string; always_yes: string; changeps1: string; + solver: string; } /**