Skip to content

Commit

Permalink
[patch] Nodefaults (#129)
Browse files Browse the repository at this point in the history
* Target branch

* Prepopulate the condarc with some channels

To avoid conda from sticking in defaults

* Leverage the condarc for channels instead of the broken channels arg

* Retarget main
  • Loading branch information
liamhuber authored Aug 27, 2024
1 parent ec00101 commit 9e97c10
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions cached-miniforge/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ inputs:
miniforge-channels:
description: 'conda-incubator/setup-miniconda argument'
default: conda-forge
# default: conda-forge,nodefaults # TODO: Use nodefaults directly once setup-miniconda is fixed
required: false
miniforge-channel-priority:
description: 'conda-incubator/setup-miniconda argument'
Expand All @@ -45,6 +46,10 @@ inputs:
description: 'conda-incubator/setup-miniconda argument'
default: 'true'
required: false
miniforge-condarc-file:
description: 'conda-incubator/setup-miniconda argument, BUT we change the default to resolve https://github.com/conda-incubator/setup-miniconda/issues/207'
default: '.condarc'
required: false
miniforge-activate-environment:
description: 'DEPRECATED. Use env-path and include a path instead. If provided, will be used as the new env-path with cached-miniforge/ prepended as the path.'
default: ''
Expand Down Expand Up @@ -101,13 +106,29 @@ runs:
path: ${{ steps.env-path-backwards-compatibility.outputs.env-path }}
key: ${{ steps.cache-info.outputs.CASH_KEY }}
lookup-only: true
- name: Prepopulate condarc
# To resolve: https://github.com/conda-incubator/setup-miniconda/issues/207
# Because conda behaves like this: https://github.com/conda/conda/issues/12356
# And now using `default` can cost money: https://www.anaconda.com/blog/is-conda-free
# Only necessary until conda-incubator/setup-miniconda is fixed: https://github.com/conda-incubator/setup-miniconda/pull/364
shell: bash -l {0}
run: |
echo "channels:" > "${{ inputs.miniforge-condarc-file }}"
IFS=',' read -ra CHANNELS <<< "${{ inputs.miniforge-channels }}"
for channel in "${CHANNELS[@]}"; do
channel=$(echo "$channel" | xargs)
echo "- $channel" >> "${{ inputs.miniforge-condarc-file }}"
done
echo "Prepopulated condarc file ${{ inputs.miniforge-condarc-file }}:"
cat ${{ inputs.miniforge-condarc-file }}
- name: Install using cached env
if: inputs.use-cache == 'true' && steps.look-for-cache.outputs.cache-hit == 'true'
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: ${{ inputs.miniforge-variant }}
miniforge-version: ${{ inputs.miniforge-version }}
channels: ${{ inputs.miniforge-channels }}
# channels: ${{ inputs.miniforge-channels }}
condarc-file: ${{ inputs.miniforge-condarc-file }} # TODO: Use channels once setup-miniconda is fixed
channel-priority: ${{ inputs.miniforge-channel-priority }}
activate-environment: ${{ steps.env-path-backwards-compatibility.outputs.env-path }}
use-mamba: ${{ inputs.miniforge-use-mamba }}
Expand All @@ -124,7 +145,8 @@ runs:
python-version: ${{ inputs.python-version }}
miniforge-variant: ${{ inputs.miniforge-variant }}
miniforge-version: ${{ inputs.miniforge-version }}
channels: ${{ inputs.miniforge-channels }}
# channels: ${{ inputs.miniforge-channels }}
condarc-file: ${{ inputs.miniforge-condarc-file }} # TODO: Use channels once setup-miniconda is fixed
channel-priority: ${{ inputs.miniforge-channel-priority }}
activate-environment: ${{ steps.env-path-backwards-compatibility.outputs.env-path }}
use-mamba: ${{ inputs.miniforge-use-mamba }}
Expand Down

0 comments on commit 9e97c10

Please sign in to comment.