Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make incorrect condarc only a warning #183

Merged
merged 7 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,30 @@ jobs:
which micromamba | grep not-on-path/bin
shell: bash -elo pipefail {0}

incorrect-condarc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# this should produce a warning
- uses: ./
with:
condarc-file: test/.condarc.2
- run: |
! micromamba info | grep .condarc.2
shell: bash -elo pipefail {0}

correct-condarc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# this should produce a warning
- uses: ./
with:
condarc-file: test/.condarc.yml
- run: |
micromamba info | grep .condarc.yml
shell: bash -elo pipefail {0}

# not properly testable
# https://github.com/actions/runner/issues/2347
# https://github.com/orgs/community/discussions/15452
Expand Down
6 changes: 4 additions & 2 deletions dist/index.js

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

6 changes: 4 additions & 2 deletions dist/post.js

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-micromamba",
"version": "1.7.1",
"version": "1.7.3",
"private": true,
"description": "Action to setup micromamba",
"scripts": {
Expand Down
13 changes: 11 additions & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,17 @@ const checkForKnownIssues = (options: Options) => {
'You are using a micromamba version < 1.4.5-0 and initialize the shell. This is behavior is deprecated. Please update the micromamba version. For further informations, see https://github.com/mamba-org/setup-micromamba/pull/107'
)
}
if (options.condarcFile && path.basename(options.condarcFile) !== '.condarc') {
throw new Error(
const condarcBasename = path.basename(options.condarcFile)
// https://github.com/mamba-org/mamba/blob/c54c4b530e6638c8712f6246200d0f5a32410b46/libmamba/src/api/configuration.cpp#L955
const hasValidCondarcName =
condarcBasename === '.condarc' ||
condarcBasename === 'condarc' ||
condarcBasename === '.mambarc' ||
condarcBasename === 'mambarc' ||
condarcBasename.endsWith('.yml') ||
condarcBasename.endsWith('.yaml')
if (!hasValidCondarcName) {
core.warning(
`You are using a condarc file that is not named '.condarc'. This is currently not supported by micromamba, see https://github.com/mamba-org/mamba/issues/1394`
)
}
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions test/.condarc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
channels:
- pytorch
2 changes: 2 additions & 0 deletions test/condarc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
channels:
- pytorch
Loading