Skip to content

Commit

Permalink
Merge pull request #966 from cta-observatory/setup_miniconda
Browse files Browse the repository at this point in the history
Use setup-miniconda in CI
  • Loading branch information
maxnoe authored Apr 12, 2022
2 parents 0dd3829 + 7dd810c commit fb04c85
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
tests:
needs: pyflakes
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}

strategy:
matrix:
# we currently only support python 3.7 since traitlets 5 requires 3.7
Expand All @@ -44,26 +49,30 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Prepare conda installation
env:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
# fix mamba error that the directory does not exist
mkdir -p ~/conda_pkgs_dir/cache
# setup correct python version
sed -i -e "s/- python=.*/- python=$PYTHON_VERSION/g" environment.yml
- name: Conda setup
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
auto-update-conda: true
activate-environment: "lst-dev"
environment-file: environment.yml

- name: Install dependencies
env:
PYTHON_VERSION: ${{ matrix.python-version }}
CTAPIPE_VERSION: ${{ matrix.ctapipe-version }}

run: |
. $CONDA/etc/profile.d/conda.sh
conda config --set always_yes yes --set changeps1 no
sed -i -e "s/- python=.*/- python=$PYTHON_VERSION/g" environment.yml
echo "Creating conda env"
conda install -c conda-forge mamba
mamba env create -n ci -f environment.yml
conda activate ci
python --version
echo "Installing additional pip packages"
# we install ctapipe using pip to be able to select any commit, e.g. the current master
pip install \
Expand All @@ -82,10 +91,6 @@ jobs:
- name: Tests
run: |
# github actions starts a new shell for each "step", so we need to
# activate our env again
source $CONDA/etc/profile.d/conda.sh
conda activate ci
pytest -n auto --dist loadscope --cov --cov-report=xml -m 'private_data or not private_data' lstchain
- uses: codecov/codecov-action@v1
Expand Down

0 comments on commit fb04c85

Please sign in to comment.