Skip to content

Commit 627754f

Browse files
committed
expand test matrix to match Travis CI
1 parent d83e67d commit 627754f

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed
Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,52 @@
1-
name: Python Package using Conda
1+
name: Conda-based pytest
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build-linux:
77
runs-on: ubuntu-latest
8+
89
strategy:
910
max-parallel: 5
11+
matrix:
12+
python-version: [2.7, 3.6, 3.9]
13+
slycot: ["", "conda"]
14+
array-and-matrix: [0]
15+
include:
16+
- python-version: 3.9
17+
slycot: conda
18+
array-and-matrix: 1
1019

1120
steps:
1221
- uses: actions/checkout@v2
13-
- name: Set up Python 3.8
22+
- name: Set up Python
1423
uses: actions/setup-python@v2
15-
with:
16-
python-version: 3.8
17-
- name: Add conda to system path
24+
- name: Set up conda
1825
run: |
19-
# $CONDA is an environment variable pointing to the root of the miniconda directory
2026
echo $CONDA/bin >> $GITHUB_PATH
27+
conda create -q -n test-environment python=${{matrix.python-version}}
2128
- name: Install dependencies
2229
run: |
23-
conda install numpy scipy matplotlib pytest
30+
source $CONDA/bin/activate test-environment
31+
conda install pip coverage pytest
32+
conda install numpy matplotlib scipy
33+
if [[ '${{matrix.python-version}}' == '2.7' ]]; then
34+
# matplotlib for Python 2.7 seems to require X11 to run correctly
35+
sudo apt install -y xvfb
36+
fi
37+
- name: Install slycot via conda (optional)
38+
if: ${{ matrix.slycot == 'conda' }}
39+
run: |
40+
source $CONDA/bin/activate test-environment
2441
conda install -c conda-forge slycot
2542
- name: Test with pytest
43+
env:
44+
PYTHON_CONTROL_ARRAY_AND_MATRIX: ${{ matrix.array-and-matrix }}
2645
run: |
27-
conda install pytest
28-
pytest
46+
source $CONDA/bin/activate test-environment
47+
if [[ '${{matrix.python-version}}' == '2.7' ]]; then
48+
# Run within (virtual) X11 environment for Python 2.7/matplotlib
49+
xvfb-run pytest control/tests
50+
else
51+
coverage run -m pytest control/tests
52+
fi

0 commit comments

Comments
 (0)