Skip to content

Commit

Permalink
Add installation-dir to customize where the installers are installe…
Browse files Browse the repository at this point in the history
…d to (#342)

Co-authored-by: jaimergp <jaimergp@users.noreply.github.com>
  • Loading branch information
isuruf and jaimergp authored Oct 30, 2024
1 parent 65da104 commit 6225267
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 59 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/example-10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,34 @@ jobs:
python -VV
printenv | sort
example-10-miniforge-installation-dir:
# 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 -el {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos", "windows"]
steps:
- uses: actions/checkout@v4
- uses: ./
id: setup-miniconda
with:
environment-file: etc/example-environment.yml
miniforge-version: latest
installation-dir: ${{ github.workspace }}/miniforge-latest
- run: |
conda info
conda list
python -VV
printenv | sort
example-10-mambaforge:
# NOTE: Mambaforge is now equivalent to Miniforge.
# We are only testing this to make sure there's a smooth transition.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ jobs:
In addition to `Miniforge3` with `conda`, `mamba` and `CPython`, you can also
install `Miniforge-pypy3`, which replaces `CPython` with `PyPy.

> [!TIP] You can customize the installation directory via the `installation-dir`
> option.

### Example 11: Alternative Architectures

In addition to the default 64-bit builds of Miniconda, 32-bit versions are
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ inputs:
installers"
required: false
default: ""
installation-dir:
description:
"If provided, the installer will be installed in the given directory."
required: false
default: ""
miniconda-version:
description:
"If provided, this version of Miniconda3 will be downloaded and installed.
Expand Down
70 changes: 38 additions & 32 deletions dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/base-tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export async function installBaseTools(
}

if (tools.length) {
await conda.condaCommand(["install", "--name", "base", ...tools], options);
await conda.condaCommand(
["install", "--name", "base", ...tools],
inputs,
options,
);

// *Now* use the new options, as we may have a new conda/mamba with more supported
// options that previously failed
Expand Down
4 changes: 2 additions & 2 deletions src/base-tools/update-mamba.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export const updateMamba: types.IToolProvider = {
};
},
postInstall: async (inputs, options) => {
const mambaExec = conda.condaExecutable(options);
const mambaExec = conda.condaExecutable(inputs, options);
const condabinLocation = path.join(
conda.condaBasePath(options),
conda.condaBasePath(inputs, options),
"condabin",
path.basename(mambaExec),
);
Expand Down
Loading

0 comments on commit 6225267

Please sign in to comment.