Skip to content

Commit

Permalink
Merge pull request #33 from goanpeca/configutations
Browse files Browse the repository at this point in the history
Configutations
  • Loading branch information
goanpeca authored May 11, 2020
2 parents 4256bc7 + 8ad7c4b commit bbb4f31
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/example-4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
activate-environment: foo
python-version: 3.6
channels: conda-forge,spyder-ide
allow-softlinks: true
channel-priority: true
show-channel-urls: true
use-only-tar-bz2: true
- shell: bash -l {0}
run: |
conda info
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ jobs:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: anaconda-client-env
environment-file: etc/example-environment.yml
python-version: 3.5
condarc-file: etc/example-condarc.yml
auto-activate-base: false
activate-environment: anaconda-client-env
environment-file: etc/example-environment.yml
python-version: 3.5
condarc-file: etc/example-condarc.yml
auto-activate-base: false
- shell: bash -l {0}
run: |
conda info
Expand All @@ -179,7 +179,7 @@ jobs:

## Example 4: Conda options

This example shows how to use `channels` option. The priority will be set by the order of the channels.
This example shows how to use `channels` option and other extra options. The priority will be set by the order of the channels.
In this example it will result in:

- conda-forge
Expand All @@ -201,18 +201,21 @@ jobs:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- uses: goanpeca/setup-miniconda@enh/channels
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: foo
python-version: 3.6
channels: conda-forge,spyder-ide
activate-environment: foo
python-version: 3.6
channels: conda-forge,spyder-ide
allow-softlinks: true
channel-priority: flexible
show-channel-urls: true
use-only-tar-bz2: true
- shell: bash -l {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
```

## IMPORTANT
Expand Down
34 changes: 31 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,50 @@ inputs:
description: 'Exact version of a Python version to use on "activate-environment". If provided, this will be installed before the "environment-file". See https://anaconda.org/anaconda/python for available "python" versions.'
required: false
default: ''
auto-update-conda:
description: 'Conda configuration. When "true", conda updates itself any time a user updates or installs a package in the base environment. When "false", conda updates itself only if the user manually issues a conda update command. The default is "true". This setting always overrides if set to "true" or "false". If you want to use the "condarc-file" setting pass and empty string. See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/ for more information.'
add-anaconda-token:
description: 'Conda configuration. When the channel alias is Anaconda.org or an Anaconda Server GUI, you can set the system configuration so that users automatically see private packages. Anaconda.org was formerly known as binstar.org. This uses the Anaconda command-line client, which you can install with conda install anaconda-client, to automatically add the token to the channel URLs. The default is "true". See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#add-anaconda-org-token-to-automatically-see-private-packages-add-anaconda-token for more information.'
required: false
default: 'false'
default: ''
add-pip-as-python-dependency:
description: 'Conda configuration. Add pip, wheel, and setuptools as dependencies of Python. This ensures that pip, wheel, and setuptools are always installed any time Python is installed. The default is "true". See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#add-pip-as-python-dependency-add-pip-as-python-dependency for more information.'
required: false
default: ''
allow-softlinks:
description: 'Conda configuration. When allow_softlinks is "true", conda uses hard-links when possible and soft-links---symlinks---when hard-links are not possible, such as when installing on a different file system than the one that the package cache is on. When allow_softlinks is "false", conda still uses hard-links when possible, but when it is not possible, conda copies files. Individual packages can override this option, specifying that certain files should never be soft-linked. The default is "true". See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#disallow-soft-linking-allow-softlinks for more information.'
required: false
default: ''
auto-activate-base:
description: 'Conda configuration. If you’d prefer that conda’s base environment not be activated on startup, set the to "false". Default is "true". This setting always overrides if set to "true" or "false". If you want to use the "condarc-file" setting pass and empty string. See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/ for more information.'
required: false
default: 'true'
auto-update-conda:
description: 'Conda configuration. When "true", conda updates itself any time a user updates or installs a package in the base environment. When "false", conda updates itself only if the user manually issues a conda update command. The default is "true". This setting always overrides if set to "true" or "false". If you want to use the "condarc-file" setting pass and empty string. See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/ for more information.'
required: false
default: 'false'
condarc-file:
description: 'Conda configuration. Path to a conda configuration file to use for the runner. This file will be copied to "~/.condarc". See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/ for more information.'
required: false
default: ''
channel-alias:
description: 'Conda configuration. Whenever you use the -c or --channel flag to give conda a channel name that is not a URL, conda prepends the channel_alias to the name that it was given. The default channel_alias is https://conda.anaconda.org. See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#set-a-channel-alias-channel-alias for more information.'
required: false
default: ''
channel-priority:
description: 'Conda configuration. Accepts values of "strict", "flexible", and "disabled". The default value is "flexible". With strict channel priority, packages in lower priority channels are not considered if a package with the same name appears in a higher priority channel. With flexible channel priority, the solver may reach into lower priority channels to fulfill dependencies, rather than raising an unsatisfiable error. With channel priority disabled, package version takes precedence, and the configured priority of channels is used only to break ties. In previous versions of conda, this parameter was configured as either "true" or "false". "true" is now an alias to "flexible". See https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html#strict-channel-priority for more information.'
required: false
default: ''
channels:
description: 'Conda configuration. Comma separated list of channels to use in order of priority. See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/ for more information.'
required: false
default: ''
show-channel-urls:
description: 'Conda configuration. Show channel URLs when displaying what is going to be downloaded and in conda list. The default is "false". See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#show-channel-urls-show-channel-urls for more information.'
required: false
default: ''
use-only-tar-bz2:
description: 'Conda configuration. Conda 4.7 introduced a new .conda package file format. .conda is a more compact and faster alternative to .tar.bz2 packages. It is thus the preferred file format to use where available. Nevertheless, it is possible to force conda to only download .tar.bz2 packages by setting the use_only_tar_bz2 boolean to "true". The default is "false". See https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#force-conda-to-download-only-tar-bz2-packages-use-only-tar-bz2 for more information.'
required: false
default: ''
remove-profiles:
description: 'Advanced. Prior to runnning "conda init" all shell profiles will be removed from the runner. Default is "true".'
required: false
Expand Down
16 changes: 15 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17375,15 +17375,29 @@ function run() {
let activateEnvironment = core.getInput("activate-environment");
let environmentFile = core.getInput("environment-file");
// Conda configuration
let addAnacondaToken = core.getInput("add-anaconda-token");
let addPipAsPythonDependency = core.getInput("add-pip-as-python-dependency");
let allowSoftlinks = core.getInput("allow-softlinks");
let autoActivateBase = core.getInput("auto-activate-base");
let autoUpdateConda = core.getInput("auto-update-conda");
let condaFile = core.getInput("condarc-file");
let channelAlias = core.getInput("channel-alias");
let channelPriority = core.getInput("channel-priority");
let channels = core.getInput("channels");
let removeProfiles = core.getInput("remove-profiles");
let showChannelUrls = core.getInput("show-channel-urls");
let useOnlyTarBz2 = core.getInput("use-only-tar-bz2");
const condaConfig = {
add_anaconda_token: addAnacondaToken,
add_pip_as_python_dependency: addPipAsPythonDependency,
allow_softlinks: allowSoftlinks,
auto_activate_base: autoActivateBase,
auto_update_conda: autoUpdateConda,
channels: channels
channel_alias: channelAlias,
channel_priority: channelPriority,
channels: channels,
show_channel_urls: showChannelUrls,
use_only_tar_bz2: useOnlyTarBz2
};
const result = yield conda.setupMiniconda(minicondaVersion, "x64", condaVersion, condaBuildVersion, pythonVersion, activateEnvironment, environmentFile, condaFile, condaConfig, removeProfiles);
if (!result["ok"]) {
Expand Down
18 changes: 17 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,32 @@ async function run() {
let environmentFile: string = core.getInput("environment-file");

// Conda configuration
let addAnacondaToken: string = core.getInput("add-anaconda-token");
let addPipAsPythonDependency: string = core.getInput(
"add-pip-as-python-dependency"
);
let allowSoftlinks: string = core.getInput("allow-softlinks");
let autoActivateBase: string = core.getInput("auto-activate-base");
let autoUpdateConda: string = core.getInput("auto-update-conda");
let condaFile: string = core.getInput("condarc-file");
let channelAlias: string = core.getInput("channel-alias");
let channelPriority: string = core.getInput("channel-priority");
let channels: string = core.getInput("channels");
let removeProfiles: string = core.getInput("remove-profiles");
let showChannelUrls: string = core.getInput("show-channel-urls");
let useOnlyTarBz2: string = core.getInput("use-only-tar-bz2");

const condaConfig = {
add_anaconda_token: addAnacondaToken,
add_pip_as_python_dependency: addPipAsPythonDependency,
allow_softlinks: allowSoftlinks,
auto_activate_base: autoActivateBase,
auto_update_conda: autoUpdateConda,
channels: channels
channel_alias: channelAlias,
channel_priority: channelPriority,
channels: channels,
show_channel_urls: showChannelUrls,
use_only_tar_bz2: useOnlyTarBz2
};
const result = await conda.setupMiniconda(
minicondaVersion,
Expand Down

0 comments on commit bbb4f31

Please sign in to comment.