GitHub Action to provision a CI instance using micromamba
Optional The the environment.yml
file for the conda environment. Default is environment.yml
Optional Specify a custom environment name,
to overwrite the name specified in the environment.yml
,
or in in case it was not specified in the environment.yml
.
Optional Specifiy a custom micromamba version. Use "latest"
for bleeding edge.
Optional Specifiy additional specifications (packages) to install. Pretty useful when using matrix builds to pin versions of a test/run dependency.
Note: for multiple packages, use multiline syntax (see examples below)
Note: some shells need special syntax for invocation (e.g. bash -l {0}
). You can set this up in defaults.
name: test
on:
push: null
jobs:
test:
runs-on: ubuntu-latest
name: test
steps:
- uses: actions/checkout@v2
- name: install mamba
uses: mamba-org/provision-with-micromamba@main
# linux and osx
- name: run python
shell: bash -l {0}
run: |
python -c "import numpy"
# windows
- name: run python
shell: powershell
run: |
python -c "import numpy"
- name: run cmd.exe
shell: cmd /C CALL {0}
run: >-
micromamba info && micromamba list
name: test
on:
push: null
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
pytest: ["6.1", "6.2"]
name: test
steps:
- uses: actions/checkout@v2
- name: install mamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: myenv.yaml
environment-name: myenv
extra-specs: |
python=3.7
pytest=${{ matrix.pytest }}
Some shells require special syntax (e.g. bash -l {0}
). You can set this up with the default
option:
jobs:
myjob:
defaults:
run:
shell: bash -l {0}
...
Find the reasons below (taken from setup-miniconda):
- Bash shells do not use
~/.profile
or~/.bashrc
so these shells need to be explicitely declared asshell: bash -l {0}
on steps that need to be properly activated (or use a default shell). This is because bash shells are executed withbash --noprofile --norc -eo pipefail {0}
thus ignoring updated on bash profile files made byconda init bash
. See Github Actions Documentation and thread. - Sh shells do not use
~/.profile
or~/.bashrc
so these shells need to be explicitely declared asshell: sh -l {0}
on steps that need to be properly activated (or use a default shell). This is because sh shells are executed withsh -e {0}
thus ignoring updated on bash profile files made byconda init bash
. See Github Actions Documentation. - Cmd shells do not run
Autorun
commands so these shells need to be explicitely declared asshell: cmd /C call {0}
on steps that need to be properly activated (or use a default shell). This is because cmd shells are executed with%ComSpec% /D /E:ON /V:OFF /S /C "CALL "{0}""
and the/D
flag disabled execution ofCommand Processor/Autorun
Windows registry keys, which is whatconda init cmd.exe
sets. See Github Actions Documentation. - For caching to work properly, you will need to set the
use-only-tar-bz2
option totrue
. - Some options (e.g.
use-only-tar-bz2
) are not available on the default conda installed on Windows VMs, be sure to useauto-update-conda
or provide a version of conda compatible with the option. - If you plan to use a
environment.yaml
file to set up the environment, the action will read thechannels
listed in the key (if found). If you provide thechannels
input in the action they must not conflict with what was defined inenvironment.yaml
, otherwise the conda solver might find conflicts and result in very long install times. - Conda activation does not correctly work on
sh
. Please usebash
.
When developing, you need to
- install
nodejs
- clone the repo
- run
npm install -y
- run
npm run build
after making changes