Skip to content

CI tests via GitHub actions and conda #504

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 10 commits into from
Jan 12, 2021
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[run]
source = control
omit = control/tests/*
relative_files = True

[report]
exclude_lines =
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/control-slycot-src.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Slycot from source

on: [push, pull_request]

jobs:
build-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Install Python dependencies
run: |
# Set up conda
echo $CONDA/bin >> $GITHUB_PATH

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

# Install test tools
conda install pip pytest

# Install python-control dependencies
conda install numpy matplotlib scipy

- name: Install slycot from source
run: |
# Install compilers, libraries, and development environment
sudo apt-get -y install gfortran cmake --fix-missing
sudo apt-get -y install libblas-dev liblapack-dev
conda install -c conda-forge scikit-build;

# Compile and install slycot
git clone https://github.com/python-control/Slycot.git slycot
cd slycot; python setup.py build_ext install -DBLA_VENDOR=Generic

- name: Test with pytest
run: xvfb-run --auto-servernum pytest control/tests
67 changes: 67 additions & 0 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Conda-based pytest

on: [push, pull_request]

jobs:
test-linux:
runs-on: ubuntu-latest

strategy:
max-parallel: 5
matrix:
python-version: [3.6, 3.9]
slycot: ["", "conda"]
array-and-matrix: [0]
include:
- python-version: 3.9
slycot: conda
array-and-matrix: 1

steps:
- uses: actions/checkout@v2

- 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

# Install test tools
conda install pip coverage pytest
pip install coveralls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coveralls is on conda-forge nowadays


# Install python-control dependencies
conda install numpy matplotlib scipy
if [[ '${{matrix.slycot}}' == 'conda' ]]; then
conda install -c conda-forge slycot
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest-cov produces one. See python-control/Slycot#140. Use the --cov parameter.

# See https://github.com/python-control/python-control/pull/504
xvfb-run --auto-servernum coverage run -m pytest control/tests

- name: Coveralls parallel
# https://github.com/coverallsapp/github-action
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true

coveralls:
name: coveralls completion
needs: test-linux
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true