Skip to content

Commit

Permalink
Make incorrect condarc only a warning (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw authored Dec 14, 2023
1 parent 85a34ff commit e820223
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 7 deletions.
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

0 comments on commit e820223

Please sign in to comment.