Skip to content

Commit

Permalink
[MRG] Using Mamba in Pipelines (#1210)
Browse files Browse the repository at this point in the history
* testing mamba installation. Simply install mamba from conda and try to create env

* added mamba after conda installation

* check if mamba installation succesful

* installing mamba before activating

* fix syntax errors

* Pin mamba to 0.4.0 and make pipelines exit on error with any bash command

* move tardis_env.sh into pipelines file

* fetch reference data fetching from bash scripts to azure pipelines file

* fix syntax error

* Added packet data

* Adding variable shellopts to check

* added shellopts=errexit so that build fails on non-zero error code

* testing if pipeline fails

* reverting changes, testing succesful

* remove unused lines

* testing, this should fail the pipeline

* Made all single lines where necessary
Added a step to fail build on error as suggested by epassaro
improved documentation to steps

* added back the git lfs pull code

* removed git lfs codes

* added git lfs to pipelines to make it faster
  • Loading branch information
kaushik94 authored Jul 19, 2020
1 parent 56f6acd commit 74ae0fe
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 24 deletions.
57 changes: 34 additions & 23 deletions azure-pipelines/simple_test_framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,52 @@ jobs:
matrix:
linux:
vm_Image: "Ubuntu-16.04"
conda: "/usr/share/miniconda"
mac:
vm_Image: "macOS-10.14"
miniconda.url: "http://repo.continuum.io/miniconda/Miniconda2-latest-mac-x86_64.sh"
maxParallel: 4
maxParallel: 2

steps:
- bash: |
echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: echo "##vso[task.setvariable variable=shellopts]errexit"
displayName: "Force exit on error (bash) "

- bash: |
sudo chown -R $USER $CONDA
# conda update -y conda
displayName: updating conda and activating
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: "Add conda to PATH"

- bash: |
sh ci-helpers/install_tardis_env.sh
displayName: "Install TARDIS env"
- bash: sudo chown -R $USER $CONDA
condition: eq( variables['Agent.OS'], 'Darwin' )
displayName: "Take ownership of conda installation (macOS)"

- bash: conda install mamba=0.4.0 -c conda-forge -y
displayName: "Install mamba"

- bash: mamba env create -f tardis_env3.yml
displayName: "Install TARDIS environment"

- bash: |
sh ci-helpers/fetch_reference_data.sh
displayName: "Fetch Reference Data"
echo git clone $(ref.data.github.url) $(ref.data.home)
git clone $(ref.data.github.url) $(ref.data.home)
cd $(ref.data.home)
git fetch origin
git checkout origin/master
git lfs pull --include="atom_data/kurucz_cd23_chianti_H_He.h5" origin
git lfs pull --include="atom_data/chianti_He.h5" origin
git lfs pull --include="plasma_reference/" origin
git lfs pull --include="unit_test_data.h5" origin
git lfs pull --include="packet_unittest.h5" origin
echo MD5: `md5sum unit_test_data.h5`
displayName: "Fetch reference data"
- bash: |
source activate tardis
python setup.py build_ext --inplace
source activate tardis
python setup.py build_ext --inplace
displayName: "TARDIS build"
- bash: |
source activate tardis
pip install pytest-azurepipelines
pytest tardis --tardis-refdata=$(ref.data.home) --cov=tardis --cov-report=xml --cov-report=html
source activate tardis
pip install pytest-azurepipelines
pytest tardis --tardis-refdata=$(ref.data.home) --cov=tardis --cov-report=xml --cov-report=html
displayName: "TARDIS test"
- script: |
bash <(curl -s https://codecov.io/bash)
- bash: |
bash <(curl -s https://codecov.io/bash)
displayName: "Upload to codecov.io"
2 changes: 2 additions & 0 deletions ci-helpers/install_miniconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if test -e $HOME/miniconda/bin; then
hash -r
#conda update --yes conda


else
wget $MINICONDA_URL -O miniconda.sh
chmod +x miniconda.sh
Expand All @@ -15,6 +16,7 @@ else
export PATH=$HOME/miniconda/bin:$PATH
hash -r
conda update --yes conda

fi

source $HOME/miniconda/etc/profile.d/conda.sh
15 changes: 14 additions & 1 deletion ci-helpers/install_tardis_env.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
#!/usr/bin/env bash
cd $TARDIS_BUILD_DIR

# install mamba
if test -e $HOME/miniconda/bin/mamba; then
echo "Mamba installed Succesfuly"

else
echo "Mamba not installed"
conda install mamba=0.4.0 -c conda-forge -y
echo "Installed Mamba to correct location"
fi

if test -e $HOME/miniconda/envs/tardis; then
echo "TARDIS env already installed.";
# Also check for tardis_env3.yml change
else
conda env create -f tardis_env3.yml
# conda env create -f tardis_env3.yml
echo "Creating TARDIS environment using Mamba"
mamba env create -f tardis_env3.yml
#trouble with building due to segfault at cython (https://github.com/cython/cython/issues/2199)
#remove if we can get normal cython through conda
fi

0 comments on commit 74ae0fe

Please sign in to comment.