Skip to content

Commit

Permalink
CI: install environment using mamba
Browse files Browse the repository at this point in the history
merges #501

CI: install environment using mamba.
mamba is faster and has better error messages than conda.

build/README.md: add mamba instructions to create environment.
  • Loading branch information
dhimmel authored Jul 31, 2023
1 parent f9fff34 commit 299abce
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/manubot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ jobs:
activate-environment: manubot
environment-file: build/environment.yml
auto-activate-base: false
miniforge-variant: Mambaforge
miniforge-version: 'latest'
use-mamba: true
- name: Install Spellcheck
if: env.SPELLCHECK == 'true'
run: bash ci/install-spellcheck.sh
Expand Down
12 changes: 10 additions & 2 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ To change the options, either edit the YAML files directly or add additional `--

Note: currently, **Windows is not supported**.

Install the [conda](https://conda.io) environment specified in [`environment.yml`](environment.yml) by running the following commands
The Manubot environment is managed with [conda](https://conda.io).
If you do not have `conda` installed, we recommend using the Miniforge3 (includes `conda`) or Mambaforge (includes `conda` and `mamba`) installers from [miniforge](https://github.com/conda-forge/miniforge).
Install the environment from [`environment.yml`](environment.yml) by running one of following commands
(from the repository's root directory):

```sh
# Install the environment
# Install the environment using conda
conda env create --file build/environment.yml

# Install the environment using mamba (faster)
mamba env create --file build/environment.yml
```

If the `manubot` environment is already installed, but needs to be updated to reflect changes to `environment.yml`, use one of the following options:
Expand All @@ -38,6 +43,9 @@ conda env update --file build/environment.yml
# Slower than option 1, but guarantees a fresh environment.
conda env remove --name manubot
conda env create --file build/environment.yml

# option 3: reinstall the manubot environment faster using mamba.
mamba env create --force --file build/environment.yml
```

Activate with `conda activate manubot` (assumes `conda` version of [at least](https://github.com/conda/conda/blob/9d759d8edeb86569c25f6eb82053f09581013a2a/CHANGELOG.md#440-2017-12-20) 4.4).
Expand Down
6 changes: 3 additions & 3 deletions ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
set -o errexit \
-o pipefail

wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge-pypy3-$(uname)-$(uname -m).sh \
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh \
--output-document miniforge.sh
bash miniforge.sh -b -p $HOME/miniconda
source $HOME/miniconda/etc/profile.d/conda.sh
hash -r
conda config \
--set always_yes yes \
--set changeps1 no
conda env create --quiet --file build/environment.yml
conda list --name manubot
mamba env create --quiet --file build/environment.yml
mamba list --name manubot
conda activate manubot

# Install Spellcheck filter for Pandoc
Expand Down

0 comments on commit 299abce

Please sign in to comment.