Skip to content

Commit

Permalink
Merge pull request #51 from dcs4cop/pont-43-micromamba
Browse files Browse the repository at this point in the history
AppVeyor config: add micromamba, install xcube from repo.

Closes #43.
Closes #50.
  • Loading branch information
pont-us authored Apr 29, 2021
2 parents 7ba5413 + e0154aa commit 241c2c1
Showing 1 changed file with 29 additions and 42 deletions.
71 changes: 29 additions & 42 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '{build}'

image:
- macos
- Ubuntu2004
- macos

configuration: Release

Expand All @@ -15,61 +15,48 @@ for:
only:
- image: macos
install:
- curl -L https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh > miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- curl -Ls https://micromamba.snakepit.net/api/micromamba/osx-64/latest | tar -xvj bin/micromamba
- mv bin/micromamba ./micromamba
-
matrix:
only:
- image: Ubuntu2004
install:
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- wget -qO- https://micromamba.snakepit.net/api/micromamba/linux-64/latest | tar -xvj bin/micromamba --strip-components=1

build_script:
- export PATH="$HOME/miniconda/bin:$PATH"
# Set up micromamba
- ./micromamba shell init -s bash -p ~/micromamba
- source ~/.bashrc
- source ~/.bash_profile
- hash -r
- conda config --set always_yes yes --set changeps1 no
# - conda update -q conda # makes travis build fail
- conda info -a # Useful for debugging any issues with conda
- conda init bash
- export CONDA_BASE=$(conda info --base)
- source $CONDA_BASE/etc/profile.d/conda.sh

# Install mamba as a dramatically faster conda replacement. Specifying a
# fixed version makes the installation of mamba itself much faster, and
# avoids potential breakage due to changes in mamba behaviour.
- conda install mamba=0.7.3 -c conda-forge

# Environments created by mamba can't be referenced by name from conda
# (presumably a bug), so we use an explicit path instead.

# Install the packages required by xcube-cds (including xcube and its
# dependencies), as well as the pytest package (needed for testing).
- mamba env create --prefix $HOME/mamba-env --file environment.yml
- mamba install --prefix $HOME/mamba-env pytest
- mkdir -p ~/micromamba/pkgs/
- export MAMBA_ROOT_PREFIX=~/micromamba
- export MAMBA_EXE=$(pwd)/micromamba
- . $MAMBA_ROOT_PREFIX/etc/profile.d/mamba.sh

# Clone the xcube repository and install its dependencies using its conda
# environment file
# Clone xcube repository, install xcube dependencies with micromamba,
# and install the latest version of xcube with setup.py.
- git clone https://github.com/dcs4cop/xcube $HOME/xcube
- mamba env update --prefix $HOME/mamba-env --file $HOME/xcube/environment.yml

# Remove the xcube conda package itself, because we want to install xcube
# directly from its repository instead.
- mamba remove --prefix $HOME/mamba-env xcube

# Activate the conda environment and list the installed packages (useful for
# debugging).
- conda activate $HOME/mamba-env
- conda list

# Install xcube from its repository using setuptools.
- micromamba create --name xc --file $HOME/xcube/environment.yml
- micromamba activate xc
- cd $HOME/xcube
- python setup.py install

# Install xcube-cds from its repository using setuptools.
# Use micromamba to install all xcube-cds dependencies *except* xcube
# (already manually installed), then install xcube-cds itself with setup.py.
- cd $APPVEYOR_BUILD_FOLDER
- grep -v "^ - xcube" environment.yml > env_no_xcube.yml
- micromamba update --yes --name xc --file env_no_xcube.yml
- python setup.py install

# Run the test suite.
- pytest
# Make sure pytest is installed
- micromamba install --yes --name xc --channel conda-forge pytest attrs

# Print some diagnostics (useful for debugging)
- micromamba list
- xcube --version
- python -c "from xcube_cds.version import version; print(f'xcube_cds version {version}')"

# Run the test suite
- python -m pytest

0 comments on commit 241c2c1

Please sign in to comment.