From 813572fb18d6f0e26c2f0bb67ab82c9cb4330e36 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Fri, 5 Aug 2022 23:55:32 +0200 Subject: [PATCH 1/3] New job name format --- .github/workflows/python-package-conda.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 87cece16b..5db9239a3 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -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: > + Python ${{ matrix.python-version }}; + ${{ matrix.slycot || 'without' }} Slycot; + ${{ matrix.pandas || 'without' }} Pandas; + ${{ matrix.cvxopt || 'without' }} CVXOPT; + ${{ matrix.array-and-matrix == 1 && '; array and matrix' || '' }} runs-on: ubuntu-latest strategy: From c617b33ded2c6ab5282a1f3bbf8370cdb2d7bd28 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Sat, 6 Aug 2022 00:15:36 +0200 Subject: [PATCH 2/3] switch to mambaforge setup with strict conda-forge channel --- .github/conda-env/test-env.yml | 11 +++++ .github/workflows/python-package-conda.yml | 52 +++++++++++----------- 2 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 .github/conda-env/test-env.yml diff --git a/.github/conda-env/test-env.yml b/.github/conda-env/test-env.yml new file mode 100644 index 000000000..cc91a1ade --- /dev/null +++ b/.github/conda-env/test-env.yml @@ -0,0 +1,11 @@ +name: test-env +dependencies: + - pip + - coverage + - coveralls + - pytest + - pytest-cov + - pytest-timeout + - numpy + - matplotlib + - scipy \ No newline at end of file diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 5db9239a3..0953f40c3 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -5,10 +5,10 @@ on: [push, pull_request] jobs: test-linux: name: > - Python ${{ matrix.python-version }}; - ${{ matrix.slycot || 'without' }} Slycot; - ${{ matrix.pandas || 'without' }} Pandas; - ${{ matrix.cvxopt || 'without' }} CVXOPT; + 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 @@ -27,43 +27,41 @@ 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 + 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 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 From afb1ce08161782b3f50a563048d4775d191c793d Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Sat, 6 Aug 2022 00:38:16 +0200 Subject: [PATCH 3/3] fix conda enviroment shell --- .github/workflows/python-package-conda.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml index 0953f40c3..4e287b45a 100644 --- a/.github/workflows/python-package-conda.yml +++ b/.github/workflows/python-package-conda.yml @@ -46,6 +46,7 @@ jobs: auto-activate-base: false - name: Install optional dependencies + shell: bash -l {0} run: | if [[ '${{matrix.slycot}}' == 'conda' ]]; then mamba install slycot @@ -58,6 +59,7 @@ jobs: fi - name: Test with pytest + shell: bash -l {0} env: PYTHON_CONTROL_ARRAY_AND_MATRIX: ${{ matrix.array-and-matrix }} run: |