Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Test activate on windows #6

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft

Test activate on windows #6

wants to merge 19 commits into from

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Jun 5, 2020

Attempt at fixing #4.

- name: Run conda list
run: conda list
- name: init pwsh
run: conda init powershell

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think conda init powershell only initialises the old powershell (v5) and not he new pwsh. Worth a try at least.

See also: #4 (comment)

Co-authored-by: Dave Hirschfeld <[email protected]>
@jtpio
Copy link
Member Author

jtpio commented Jun 12, 2020

Thanks @dhirschfeld!

wolfv and others added 2 commits June 12, 2020 11:51
@dhirschfeld
Copy link

That's good news - it passed the first step. Now we just need to fix the others...

conda env list
echo "$env:path"
- name: Install stuff
run: conda activate base && mamba install -y -c conda-forge xtensor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: conda activate base && mamba install -y -c conda-forge xtensor
shell: powershell
run: |
conda activate base
mamba install -y -c conda-forge xtensor

- name: Install Notebook and widgets
run: mamba install -y -c notebook ipywidgets
run: mamba install -y -c conda-forge notebook ipywidgets

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: mamba install -y -c conda-forge notebook ipywidgets
shell: powershell
run: |
conda activate base
mamba install -y -c conda-forge notebook ipywidgets

@jtpio
Copy link
Member Author

jtpio commented Jun 12, 2020

That's good news - it passed the first step. Now we just need to fix the others...

But don't we want to have this in the action itself? So the users of the action don't need to explicitly activate the environment?

- name: Install Notebook and widgets
run: mamba install -y -c notebook ipywidgets
run: mamba install -y -c conda-forge notebook ipywidgets
- name: List the packages
run: mamba list

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: mamba list
shell: powershell
run: |
conda activate base
mamba list

@dhirschfeld
Copy link

I'm not entirely sure the repeated activation is necessary but I figure it's easiest to get something working then take out what isn't needed.

@dhirschfeld
Copy link

dhirschfeld commented Jun 12, 2020

I think conda init should automatically activate the base env so they won't be necessary but if it turns out they are you can set a config to do it automatically:

conda config --set auto_activate_base true

@dhirschfeld
Copy link

Also, to not have to set shell: powershell on every step you could set a default (IIUC):
https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun

@jtpio
Copy link
Member Author

jtpio commented Jun 12, 2020

I think conda init should automatically activate the base env so they won't be necessary but if it turns out they are you can set a config to do it automatically

It looks like that could do the trick 👍

@wolfv
Copy link
Member

wolfv commented Jun 12, 2020

I didn't see all the new comments and modified stuff to use mamba.bat directly. However, that didn't work either so feel free to revert that

@dhirschfeld
Copy link

I had a play around in #7 but didn't get to the bottom of it :(

Note that the fail-fast: false means that powershell will continue even if a call to an exe fails. This behaviour can be changed by putting $ErrorActionPreference = 'stop'; in each script.
https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference

This caused me some confusion when I thought the Run /./ task had failed but it had an error in the activation.
https://github.com/TheSnakePit/setup-mamba/pull/7/checks?check_run_id=765337498#step:4:4

When I instrument the script with mamba --version I get a result:

mamba 0.3.3
conda 4.8.3

...which is quite strange because mamba install definitely doesn't seem to work.

When I tried with Start-Process I didn't even get an exit code which I suspect means the process wasn't even started. Not sure.

I don't know why version would work and not install? I suspect maybe version doesn't hit any C++ code whereas install does?

I not too sure how you could debug further short of exec'ing into the container and trying out the mamba command to see what actually does happen.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants