diff --git a/.coveragerc b/.coveragerc index 1a7311855..971e393ef 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,6 +1,7 @@ [run] source = control omit = control/tests/* +relative_files = True [report] exclude_lines = diff --git a/.github/workflows/control-slycot-src.yml b/.github/workflows/control-slycot-src.yml new file mode 100644 index 000000000..41d56bf4a --- /dev/null +++ b/.github/workflows/control-slycot-src.yml @@ -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 diff --git a/.github/workflows/python-package-conda.yml b/.github/workflows/python-package-conda.yml new file mode 100644 index 000000000..a3388af79 --- /dev/null +++ b/.github/workflows/python-package-conda.yml @@ -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 + + # 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 + # 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