|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - auto-backport-of-pr-[0-9]+ |
| 7 | + - v[0-9]+.[0-9]+.[0-9x]+-doc |
| 8 | + pull_request: |
| 9 | + |
| 10 | +env: |
| 11 | + NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test. |
| 12 | + OPENBLAS_NUM_THREADS: 1 |
| 13 | + PYTHONFAULTHANDLER: 1 |
| 14 | + |
| 15 | +jobs: |
| 16 | + test: |
| 17 | + name: "Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.name-suffix }}" |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - name-suffix: "(Minimum Versions)" |
| 24 | + os: ubuntu-16.04 |
| 25 | + python-version: 3.7 |
| 26 | + extra-requirements: '-c requirements/testing/minver.txt' |
| 27 | + delete-font-cache: true |
| 28 | + XVFB_RUN: xvfb-run -a |
| 29 | + - os: ubuntu-16.04 |
| 30 | + python-version: 3.7 |
| 31 | + extra-requirements: '-r requirements/testing/travis_extra.txt' |
| 32 | + XVFB_RUN: xvfb-run -a |
| 33 | + - os: ubuntu-16.04 |
| 34 | + python-version: 3.8 |
| 35 | + extra-requirements: '-r requirements/testing/travis_extra.txt' |
| 36 | + XVFB_RUN: xvfb-run -a |
| 37 | + - os: macos-latest |
| 38 | + python-version: 3.8 |
| 39 | + XVFB_RUN: "" |
| 40 | + |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v2 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + |
| 46 | + - name: Set up Python ${{ matrix.python-version }} |
| 47 | + uses: actions/setup-python@v2 |
| 48 | + with: |
| 49 | + python-version: ${{ matrix.python-version }} |
| 50 | + |
| 51 | + - name: Install OS dependencies |
| 52 | + run: | |
| 53 | + case "${{ runner.os }}" in |
| 54 | + Linux) |
| 55 | + sudo apt-get update -yy |
| 56 | + sudo apt-get install -yy \ |
| 57 | + ccache \ |
| 58 | + cm-super \ |
| 59 | + dvipng \ |
| 60 | + ffmpeg \ |
| 61 | + gdb \ |
| 62 | + gir1.2-gtk-3.0 \ |
| 63 | + graphviz \ |
| 64 | + inkscape \ |
| 65 | + lcov \ |
| 66 | + libcairo2 \ |
| 67 | + libcairo2-dev \ |
| 68 | + libffi-dev \ |
| 69 | + libgeos-dev \ |
| 70 | + libgirepository1.0-dev \ |
| 71 | + libsdl2-2.0-0 \ |
| 72 | + libxkbcommon-x11-0 \ |
| 73 | + libxcb-icccm4 \ |
| 74 | + libxcb-image0 \ |
| 75 | + libxcb-keysyms1 \ |
| 76 | + libxcb-randr0 \ |
| 77 | + libxcb-render-util0 \ |
| 78 | + libxcb-xinerama0 \ |
| 79 | + lmodern \ |
| 80 | + fonts-freefont-otf \ |
| 81 | + texlive-pictures \ |
| 82 | + pkg-config \ |
| 83 | + qtbase5-dev \ |
| 84 | + texlive-fonts-recommended \ |
| 85 | + texlive-latex-base \ |
| 86 | + texlive-latex-extra \ |
| 87 | + texlive-latex-recommended \ |
| 88 | + texlive-luatex \ |
| 89 | + texlive-xetex \ |
| 90 | + ttf-wqy-zenhei |
| 91 | + ;; |
| 92 | + macOS) |
| 93 | + brew update |
| 94 | + brew install ccache |
| 95 | + ;; |
| 96 | + esac |
| 97 | +
|
| 98 | + - name: Cache pip |
| 99 | + uses: actions/cache@v2 |
| 100 | + if: startsWith(runner.os, 'Linux') |
| 101 | + with: |
| 102 | + path: ~/.cache/pip |
| 103 | + key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements/*/*.txt') }} |
| 104 | + restore-keys: | |
| 105 | + ${{ runner.os }}-py${{ matrix.python-version }}-pip- |
| 106 | + - name: Cache pip |
| 107 | + uses: actions/cache@v2 |
| 108 | + if: startsWith(runner.os, 'macOS') |
| 109 | + with: |
| 110 | + path: ~/Library/Caches/pip |
| 111 | + key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('requirements/*/*.txt') }} |
| 112 | + restore-keys: | |
| 113 | + ${{ runner.os }}-py${{ matrix.python-version }}-pip- |
| 114 | + - name: Cache ccache |
| 115 | + uses: actions/cache@v2 |
| 116 | + with: |
| 117 | + path: | |
| 118 | + ~/.ccache |
| 119 | + key: ${{ runner.os }}-py${{ matrix.python-version }}-ccache-${{ hashFiles('src/*') }} |
| 120 | + restore-keys: | |
| 121 | + ${{ runner.os }}-py${{ matrix.python-version }}-ccache- |
| 122 | + - name: Cache Matplotlib |
| 123 | + uses: actions/cache@v2 |
| 124 | + with: |
| 125 | + path: | |
| 126 | + ~/.cache/matplotlib |
| 127 | + !~/.cache/matplotlib/tex.cache |
| 128 | + !~/.cache/matplotlib/test_cache |
| 129 | + key: ${{ runner.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}-${{ github.sha }} |
| 130 | + restore-keys: | |
| 131 | + ${{ runner.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}- |
| 132 | + ${{ runner.os }}-py${{ matrix.python-version }}-mpl- |
| 133 | +
|
| 134 | + - name: Install Python dependencies |
| 135 | + run: | |
| 136 | + # Upgrade pip and setuptools and wheel to get as clean an install as |
| 137 | + # possible. |
| 138 | + python -mpip install --upgrade pip setuptools wheel |
| 139 | +
|
| 140 | + # Install dependencies from PyPI. |
| 141 | + python -mpip install --upgrade $PRE \ |
| 142 | + cycler kiwisolver numpy pillow pyparsing python-dateutil \ |
| 143 | + -r requirements/testing/travis_all.txt \ |
| 144 | + ${{ matrix.extra-requirements }} |
| 145 | +
|
| 146 | + # Install optional dependencies from PyPI. |
| 147 | + # Sphinx is needed to run sphinxext tests |
| 148 | + python -mpip install --upgrade sphinx |
| 149 | +
|
| 150 | + # GUI toolkits are pip-installable only for some versions of Python |
| 151 | + # so don't fail if we can't install them. Make it easier to check |
| 152 | + # whether the install was successful by trying to import the toolkit |
| 153 | + # (sometimes, the install appears to be successful but shared |
| 154 | + # libraries cannot be loaded at runtime, so an actual import is a |
| 155 | + # better check). |
| 156 | + if [[ "${{ runner.os }}" != 'macOS' ]]; then |
| 157 | + # PyGObject, pycairo, and cariocffi do not install on OSX 10.12; |
| 158 | + # pycairo 1.20+ requires a new version of Cairo, unavailable on |
| 159 | + # Ubuntu 16.04, so PyGObject must be installed without build |
| 160 | + # isolation in order to pick up the lower pre-installed version. |
| 161 | + python -mpip install --upgrade 'pycairo<1.20.0' 'cairocffi>=0.8' && |
| 162 | + python -mpip install --upgrade --no-build-isolation PyGObject && |
| 163 | + python -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' && |
| 164 | + echo 'PyGObject is available' || |
| 165 | + echo 'PyGObject is not available' |
| 166 | +
|
| 167 | + # There are no functioning wheels available for OSX 10.12 (as of |
| 168 | + # Sept 2020) for either pyqt5 (there are only wheels for 10.13+) or |
| 169 | + # pyside2 (the latest version (5.13.2) with 10.12 wheels has a |
| 170 | + # fatal to us bug, it was fixed in 5.14.0 which has 10.13 wheels) |
| 171 | + python -mpip install --upgrade pyqt5 && |
| 172 | + python -c 'import PyQt5.QtCore' && |
| 173 | + echo 'PyQt5 is available' || |
| 174 | + echo 'PyQt5 is not available' |
| 175 | + python -mpip install --upgrade pyside2 && |
| 176 | + python -c 'import PySide2.QtCore' && |
| 177 | + echo 'PySide2 is available' || |
| 178 | + echo 'PySide2 is not available' |
| 179 | + fi |
| 180 | + python -mpip install --upgrade \ |
| 181 | + -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \ |
| 182 | + wxPython && |
| 183 | + python -c 'import wx' && |
| 184 | + echo 'wxPython is available' || |
| 185 | + echo 'wxPython is not available' |
| 186 | +
|
| 187 | + - name: Install Matplotlib |
| 188 | + run: | |
| 189 | + ccache -s |
| 190 | + git describe |
| 191 | +
|
| 192 | + # Set flag in a delayed manner to avoid issues with installing other |
| 193 | + # packages |
| 194 | + if [[ "${{ runner.os }}" != 'macOS' ]]; then |
| 195 | + export CPPFLAGS=--coverage |
| 196 | + fi |
| 197 | +
|
| 198 | + # All dependencies must have been pre-installed, so that the minver |
| 199 | + # constraints are held. |
| 200 | + python -mpip install --no-deps -e . |
| 201 | +
|
| 202 | + if [[ "${{ runner.os }}" != 'macOS' ]]; then |
| 203 | + unset CPPFLAGS |
| 204 | + fi |
| 205 | +
|
| 206 | + - name: Clear font cache |
| 207 | + run: | |
| 208 | + rm -rf ~/.cache/matplotlib |
| 209 | + if: matrix.delete-font-cache |
| 210 | + |
| 211 | + - name: Run pytest |
| 212 | + run: | |
| 213 | + ${{ matrix.XVFB_RUN }} python -mpytest -raR -n auto \ |
| 214 | + --maxfail=50 --timeout=300 --durations=25 \ |
| 215 | + --cov-report= --cov=lib --log-level=DEBUG |
| 216 | +
|
| 217 | + - name: Filter C coverage |
| 218 | + run: | |
| 219 | + lcov --capture --directory . --output-file coverage.info |
| 220 | + lcov --output-file coverage.info \ |
| 221 | + --extract coverage.info $PWD/src/'*' $PWD/lib/'*' |
| 222 | + lcov --list coverage.info |
| 223 | + find . -name '*.gc*' -delete |
| 224 | + if: ${{ runner.os != 'macOS' }} |
| 225 | + - name: Upload code coverage |
| 226 | + uses: codecov/codecov-action@v1 |
0 commit comments