Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7c84b2

Browse files
committed
Port test CI from Travis to GitHub Actions.
This is currently Linux-only, and skips caching and code coverage.
1 parent f1e0bb9 commit d7c84b2

1 file changed

Lines changed: 161 additions & 0 deletions

File tree

.github/workflows/tests.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
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+
9+
env:
10+
NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test.
11+
OPENBLAS_NUM_THREADS: 1
12+
PYTHONFAULTHANDLER: 1
13+
XVFB_RUN: xvfb-run -a
14+
15+
jobs:
16+
test:
17+
name: "Python ${{ matrix.python-version }} ${{ matrix.name-suffix }}"
18+
runs-on: ubuntu-16.04
19+
20+
strategy:
21+
matrix:
22+
include:
23+
- name-suffix: "(Minimum Versions)"
24+
python-version: 3.7
25+
extra-requirements: '-c requirements/testing/minver.txt'
26+
delete-font-cache: true
27+
- python-version: 3.7
28+
extra-requirements: '-r requirements/testing/travis_extra.txt'
29+
- python-version: 3.8
30+
extra-requirements: '-r requirements/testing/travis_extra.txt'
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Set up Python ${{ matrix.python-version }}
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Install OS dependencies
43+
run: |
44+
case "${{ runner.os }}" in
45+
Linux)
46+
sudo apt-get update -yy
47+
sudo apt-get install -yy \
48+
cm-super \
49+
dvipng \
50+
ffmpeg \
51+
gdb \
52+
gir1.2-gtk-3.0 \
53+
graphviz \
54+
inkscape \
55+
lcov \
56+
libcairo2 \
57+
libcairo2-dev \
58+
libffi-dev \
59+
libgeos-dev \
60+
libgirepository1.0-dev \
61+
libsdl2-2.0-0 \
62+
libxkbcommon-x11-0 \
63+
libxcb-icccm4 \
64+
libxcb-image0 \
65+
libxcb-keysyms1 \
66+
libxcb-randr0 \
67+
libxcb-render-util0 \
68+
libxcb-xinerama0 \
69+
lmodern \
70+
fonts-freefont-otf \
71+
texlive-pictures \
72+
pkg-config \
73+
qtbase5-dev \
74+
texlive-fonts-recommended \
75+
texlive-latex-base \
76+
texlive-latex-extra \
77+
texlive-latex-recommended \
78+
texlive-luatex \
79+
texlive-xetex \
80+
ttf-wqy-zenhei
81+
;;
82+
macOS)
83+
ci/osx-deps
84+
;;
85+
esac
86+
87+
- name: Install Python dependencies
88+
run: |
89+
# Upgrade pip and setuptools and wheel to get as clean an install as
90+
# possible.
91+
python -mpip install --upgrade pip setuptools wheel
92+
93+
# Install dependencies from PyPI.
94+
python -mpip install --upgrade $PRE \
95+
-r requirements/testing/travis_all.txt \
96+
${{ matrix.extra-requirements }}
97+
98+
# Install optional dependencies from PyPI.
99+
# Sphinx is needed to run sphinxext tests
100+
python -mpip install --upgrade sphinx
101+
102+
# GUI toolkits are pip-installable only for some versions of Python
103+
# so don't fail if we can't install them. Make it easier to check
104+
# whether the install was successful by trying to import the toolkit
105+
# (sometimes, the install appears to be successful but shared
106+
# libraries cannot be loaded at runtime, so an actual import is a
107+
# better check).
108+
109+
# PyGObject, pycairo, and cariocffi do not install on OSX 10.12
110+
111+
# There are not functioning wheels available for OSX 10.12 (as of
112+
# Sept 2020) for either pyqt5 (there are only wheels for 10.13+)
113+
# or pyside2 (the latest version (5.13.2) with 10.12 wheels has a
114+
# fatal to us bug, it was fixed in 5.14.0 which has 10.13 wheels)
115+
if [[ "${{ runner.os }}" != 'macOS' ]]; then
116+
python -mpip install --upgrade pycairo 'cairocffi>=0.8' PyGObject &&
117+
python -c 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk' &&
118+
echo 'PyGObject is available' ||
119+
echo 'PyGObject is not available'
120+
python -mpip install --upgrade pyqt5 &&
121+
python -c 'import PyQt5.QtCore' &&
122+
echo 'PyQt5 is available' ||
123+
echo 'PyQt5 is not available'
124+
python -mpip install --upgrade pyside2 &&
125+
python -c 'import PySide2.QtCore' &&
126+
echo 'PySide2 is available' ||
127+
echo 'PySide2 is not available'
128+
fi
129+
python -mpip install --upgrade \
130+
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \
131+
wxPython &&
132+
python -c 'import wx' &&
133+
echo 'wxPython is available' ||
134+
echo 'wxPython is not available'
135+
136+
- name: Install Matplotlib
137+
run: |
138+
git describe
139+
140+
# Set flag in a delayed manner to avoid issues with installing other
141+
# packages
142+
if [[ "${{ runner.os }}" != 'macOS' ]]; then
143+
export CPPFLAGS=--coverage
144+
fi
145+
146+
python -mpip install -e .
147+
148+
if [[ "${{ runner.os }}" != 'macOS' ]]; then
149+
unset CPPFLAGS
150+
fi
151+
152+
- name: Clear font cache
153+
run: |
154+
rm -rf ~/.cache/matplotlib
155+
if: matrix.delete-font-cache
156+
157+
- name: Run pytest
158+
run: |
159+
${{ matrix.XVFB_RUN }} python -mpytest -raR -n auto \
160+
--maxfail=50 --timeout=300 --durations=25 \
161+
--cov-report= --cov=lib --log-level=DEBUG

0 commit comments

Comments
 (0)