Skip to content

Switch CI to mambaforge and conda-forge channel #757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/conda-env/test-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: test-env
dependencies:
- pip
- coverage
- coveralls
- pytest
- pytest-cov
- pytest-timeout
- numpy
- matplotlib
- scipy
53 changes: 29 additions & 24 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ on: [push, pull_request]

jobs:
test-linux:
name: Python ${{ matrix.python-version }}${{ matrix.slycot && format(' with Slycot from {0}', matrix.slycot) || ' without Slycot' }}${{ matrix.pandas && ', with pandas' || '' }}${{ matrix.array-and-matrix == 1 && ', array and matrix' || '' }}${{ matrix.cvxopt && format(' with cvxopt from {0}', matrix.cvxopt) || ' without cvxopt' }}
name: >
Py${{ matrix.python-version }};
${{ matrix.slycot || 'no' }} Slycot;
${{ matrix.pandas || 'no' }} Pandas;
${{ matrix.cvxopt || 'no' }} CVXOPT;
${{ matrix.array-and-matrix == 1 && '; array and matrix' || '' }}
runs-on: ubuntu-latest

strategy:
Expand All @@ -22,43 +27,43 @@ jobs:
array-and-matrix: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install dependencies
run: |
# Set up conda
echo $CONDA/bin >> $GITHUB_PATH
conda create -q -n test-environment python=${{matrix.python-version}}
source $CONDA/bin/activate test-environment

# Set up (virtual) X11
sudo apt install -y xvfb
- name: Set up (virtual) X11
run: sudo apt install -y xvfb

# Install test tools
conda install pip coverage pytest pytest-timeout
pip install coveralls
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
activate-environment: test-env
environment-file: .github/conda-env/test-env.yml
miniforge-version: latest
miniforge-variant: Mambaforge
channels: conda-forge
channel-priority: strict
auto-update-conda: false
auto-activate-base: false

# Install python-control dependencies
conda install numpy matplotlib scipy
- name: Install optional dependencies
shell: bash -l {0}
run: |
if [[ '${{matrix.slycot}}' == 'conda' ]]; then
conda install -c conda-forge slycot
mamba install slycot
fi
if [[ '${{matrix.pandas}}' == 'conda' ]]; then
conda install pandas
mamba install pandas
fi
if [[ '${{matrix.cvxopt}}' == 'conda' ]]; then
conda install -c conda-forge cvxopt
mamba install cvxopt
fi

- name: Test with pytest
shell: bash -l {0}
env:
PYTHON_CONTROL_ARRAY_AND_MATRIX: ${{ matrix.array-and-matrix }}
run: |
source $CONDA/bin/activate test-environment
# Use xvfb-run instead of pytest-xvfb to get proper mpl backend
# Use coverage instead of pytest-cov to get .coverage file
# See https://github.com/python-control/python-control/pull/504
xvfb-run --auto-servernum coverage run -m pytest control/tests
xvfb-run --auto-servernum pytest --cov=control --cov-config=.coveragerc control/tests

- name: Coveralls parallel
# https://github.com/coverallsapp/github-action
Expand Down