|
| 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