From 9005f523c0cc413d7c437f925003c3b177f8d41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Tue, 12 Apr 2022 15:46:40 +0200 Subject: [PATCH 1/2] Use setup-miniconda in CI --- .github/workflows/ci.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdc5dfd358..adbce5ecb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,10 +44,22 @@ 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: @@ -55,15 +67,7 @@ jobs: 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 \ From 7dd810cb945e9ebbabff84221f5293499b90704b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Tue, 12 Apr 2022 15:49:09 +0200 Subject: [PATCH 2/2] Add shell setting --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adbce5ecb7..47bcbad044 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -86,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