Skip to content

Add 'conda-remove-defaults' setting and support 'nodefaults' as a keyword channel #13

Add 'conda-remove-defaults' setting and support 'nodefaults' as a keyword channel

Add 'conda-remove-defaults' setting and support 'nodefaults' as a keyword channel #13

Workflow file for this run

name: "Example 14: Remove defaults channel"
on:
pull_request:
branches:
- "*"
push:
branches:
- "develop"
- "main"
- "master"
schedule:
# Note that cronjobs run on master/main by default
- cron: "0 0 * * *"
concurrency:
group:
${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
example-14:
# prevent cronjobs from running on forks
if:
(github.event_name == 'schedule' && github.repository ==
'conda-incubator/setup-miniconda') || (github.event_name != 'schedule')
name:
Ex14 (${{ matrix.os }}, remove=${{ matrix.conda-remove-defaults }},
channels=${{ matrix.channels }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
conda-remove-defaults: ["true", "false"]
channels:
[
"conda-forge",
"conda-forge,nodefaults",
"conda-forge,defaults,nodefaults",
]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: ./
id: setup-miniconda
continue-on-error: true
with:
channels: ${{ matrix.channels }}
conda-remove-defaults: ${{ matrix.conda-remove-defaults }}
python-version: "3.12"
- shell: bash -elc "python {0}"
run: |
import json
from subprocess import check_output
out = check_output(["conda", "config", "--show", "channels", "--json"])
channels = json.loads(out)["channels"]
input_channels = "${{ matrix.channels }}"
remove_defaults = "${{ matrix.conda-remove-defaults }}" == "true"
print("Input channels:", input_channels)
print("Input remove-defaults:", remove_defaults)
print("Computed channels:", channels)
assert "nodefaults" not in channels
if "defaults" in input_channels:
assert "defaults" in channels
elif "nodefaults" in input_channels or remove_defaults:
assert "defaults" not in channels