From d0461652a37e25633e09edbd84f2eb4288d7bb97 Mon Sep 17 00:00:00 2001 From: Moritz Kern <92092328+Moritz-Alexander-Kern@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:21:25 +0100 Subject: [PATCH] [Fix] CI docs runner conda (#615) * fix docs runner * activate env for steps install, list, and make html * remove conda update * add install for pandoc * change environment file * optimize macOS runner * update setup-miniconda t newer version * edit shell command * Revert "edit shell command" This reverts commit 03cd19d13b741115716a8b9ea6a4e2ed81a95023. * add comment * use mamba in CI runners * add channels * add channels * add proper python version * update to latest version * add python version * change python version * change mamba version * activate base * no auto update * revert changes * add update * change channel * openmpi install * don't pin channel * docs runner update * add libstd install * reverse to conda * update env * use openmpi * use conda for mpi4py * remove comment * remove env list for Conda runner --------- Co-authored-by: Moritz-Alexander-Kern --- .github/workflows/CI.yml | 63 +++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 76679cf71..ae49877ce 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -139,10 +139,13 @@ jobs: path: ~/conda_pkgs_dir key: ${{ runner.os }}-conda-${{hashFiles('requirements/environment.yml') }}-${{ hashFiles('**/CI.yml') }}-${{ steps.date.outputs.date }} - - uses: conda-incubator/setup-miniconda@3b0f2504dd76ef23b6d31f291f4913fb60ab5ff3 # corresponds to v2.2.0 + - uses: conda-incubator/setup-miniconda@030178870c779d9e5e1b4e563269f3aa69b04081 # corresponds to v3.0.3 with: auto-update-conda: true python-version: ${{ matrix.python-version }} + mamba-version: "*" + channels: conda-forge,defaults + channel-priority: true activate-environment: elephant environment-file: requirements/environment-tests.yml auto-activate-base: false @@ -152,17 +155,16 @@ jobs: shell: bash -l {0} run: | python --version - conda env list - conda install mpi4py openmpi - conda install pytest - conda install pytest-cov coveralls + mamba install mpi4py openmpi + mamba install pytest + mamba install pytest-cov coveralls pip install -e .[extras] - name: List packages shell: bash -l {0} run: | pip list - conda list + mamba list python --version - name: Test with pytest @@ -310,7 +312,6 @@ jobs: matrix: # OS [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest] - python-version: [3.9] # do not cancel all in-progress jobs if any matrix job fails fail-fast: false @@ -325,34 +326,34 @@ jobs: key: ${{ runner.os }}-pip-${{hashFiles('requirements/environment-tests.yml') }}-${{ hashFiles('**/CI.yml') }}-${{ steps.date.outputs.date }} - - uses: conda-incubator/setup-miniconda@3b0f2504dd76ef23b6d31f291f4913fb60ab5ff3 # corresponds to v2.2.0 + - uses: conda-incubator/setup-miniconda@030178870c779d9e5e1b4e563269f3aa69b04081 # corresponds to v3.0.3 with: auto-update-conda: true - python-version: ${{ matrix.python-version }} + python-version: 3.11 + mamba-version: "*" + channels: conda-forge,defaults + channel-priority: true activate-environment: elephant environment-file: requirements/environment-tests.yml - auto-activate-base: false - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - name: Install dependencies - shell: bash -l {0} + shell: bash -el {0} run: | python --version - conda env list conda install mpi4py openmpi - conda install pytest - conda install pytest-cov coveralls + mamba install pytest + mamba install pytest-cov coveralls pip install -e . - name: List packages - shell: bash -l {0} + shell: bash -el {0} run: | pip list - conda list + mamba list python --version - name: Test with pytest - shell: bash -l {0} + shell: bash -el {0} run: | pytest --cov=elephant @@ -379,11 +380,6 @@ jobs: - uses: actions/checkout@v3 - - name: Add conda to system path - run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH - - name: Cache pip uses: actions/cache@v3 with: @@ -392,15 +388,22 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-docs.txt') }}-${{ hashFiles('**/requirements-tutorials.txt') }}-${{ hashFiles('**/environment-docs.yml') }} -${{ hashFiles('**/CI.yml') }}-${{ steps.date.outputs.date }} + - uses: conda-incubator/setup-miniconda@030178870c779d9e5e1b4e563269f3aa69b04081 # corresponds to v3.0.3 + with: + auto-update-conda: true + python-version: 3.11 + mamba-version: "*" + activate-environment: elephant + environment-file: requirements/environment.yml + - name: Install dependencies + shell: bash -el {0} # enables conda incubator to activate environment run: | - conda config --add channels conda-forge # bugfix with scipy==1.8.1: libstdcxx-ng 12.1.0 required sudo apt-get update sudo apt install -y libopenmpi-dev openmpi-bin - conda update conda + conda install -c conda-forge openmpi pandoc libstdcxx-ng # fix libstdc++.so.6: version for new scipy versions > 1.9.1 - conda env update --file requirements/environment-docs.yml --name base - activate base + mamba env update --file requirements/environment-docs.yml --name elephant python -m pip install --upgrade pip pip install -r requirements/requirements-docs.txt pip install -r requirements/requirements-tutorials.txt @@ -409,15 +412,15 @@ jobs: sed -i -E "s/nbsphinx_execute *=.*/nbsphinx_execute = 'always'/g" doc/conf.py - name: List packages + shell: bash -el {0} run: | - activate base pip list - conda list + mamba list python --version - name: make html + shell: bash -el {0} run: | - activate base cd doc make html