8000 Merge pull request #504 from murrayrm/github-actions-conda · python-control/python-control@1e6da71 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1e6da71

Browse files
authored
Merge pull request #504 from murrayrm/github-actions-conda
CI tests via GitHub actions
2 parents a82b520 + 40aac67 commit 1e6da71

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[run]
22
source = control
33
omit = control/tests/*
4+
relative_files = True
45

56
[report]
67
exclude_lines =
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Slycot from source
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-linux:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Python
12+
uses: actions/setup-python@v2
13+
- name: Install Python dependencies
14+
run: |
15+
# Set up conda
16+
echo $CONDA/bin >> $GITHUB_PATH
17+
18+
# Set up (virtual) X11
19+
sudo apt install -y xvfb
20+
21+
# Install test tools
22+
conda install pip pytest
23+
24+
# Install python-control dependencies
25+
conda install numpy matplotlib scipy
26+
27+
- name: Install slycot from source
28+
run: |
29+
# Install compilers, libraries, and development environment
30+
sudo apt-get -y install gfortran cmake --fix-missing
31+
sudo apt-get -y install libblas-dev liblapack-dev
32+
conda install -c conda-forge scikit-build;
33+
34+
# Compile and install slycot
35+
git clone https://github.com/python-control/Slycot.git slycot
36+
cd slycot; python setup.py build_ext install -DBLA_VENDOR=Generic
37+
38+
- name: Test with pytest
39+
run: xvfb-run --auto-servernum pytest control/tests
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Conda-based pytest
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-linux:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
max-parallel: 5
11+
matrix:
12+
python-version: [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
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Install dependencies
24+
run: |
25+
# Set up conda
26+
echo $CONDA/bin >> $GITHUB_PATH
27+
conda create -q -n test-environment python=${{matrix.python-version}}
28+
source $CONDA/bin/activate test-environment
29+
30+
# Set up (virtual) X11
31+
sudo apt install -y xvfb
32+
33+
# Install test tools
34+
conda install pip coverage pytest
35+
pip install coveralls
36+
37+
# Install python-control dependencies
38+
conda install numpy matplotlib scipy
39+
if [[ '${{matrix.slycot}}' == 'conda' ]]; then
40+
conda install -c conda-forge slycot
41+
fi
42+
43+
- name: Test with pytest
44+
env:
45+
PYTHON_CONTROL_ARRAY_AND_MATRIX: ${{ matrix.array-and-matrix }}
46+
run: |
47+
source $CONDA/bin/activate test-environment
48+
# Use xvfb-run instead of pytest-xvfb to get proper mpl backend
49+
# Use coverage instead of pytest-cov to get .coverage file
50+
# See https://github.com/python-control/python-control/pull/504
51+
xvfb-run --auto-servernum coverage run -m pytest control/tests
52+
53+
- name: Coveralls parallel
54+
# https://github.com/coverallsapp/github-action
55+
uses: AndreMiras/coveralls-python-action@develop
56+
with:
57+
parallel: true
58+
59+
coveralls:
60+
name: coveralls completion
61+
needs: test-linux
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Coveralls Finished
65+
uses: AndreMiras/coveralls-python-action@develop
66+
with:
67+
parallel-finished: true

0 commit comments

Comments
 (0)
0