-
Notifications
You must be signed in to change notification settings - Fork 127
149 lines (129 loc) · 5.76 KB
/
pr-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Pull Request CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
pull_request:
paths:
- requirements-test-libraries.txt
env:
# Colored pytest output on CI despite not having a tty
FORCE_COLOR: 1
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11']
pyinstaller: ["https://github.com/pyinstaller/pyinstaller/archive/develop.zip"]
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
fail-fast: false
env:
# Rebuild bootloader when installing PyInstaller from develop branch
PYINSTALLER_COMPILE_BOOTLOADER: 1
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Limit dependencies to only new/changed libraries.
if: "${{ github.event.pull_request }}"
shell: bash
run: |
git fetch origin ${{ github.base_ref }}
set +e
diff --changed-group-format='%>' --unchanged-group-format='' \
<(git show origin/${{ github.base_ref }}:requirements-test-libraries.txt) \
<(git show HEAD:requirements-test-libraries.txt) \
> requirements-test-libraries.txt
set -e
echo '-r requirements-test.txt' >> requirements-test-libraries.txt
if grep -q pyqtgraph requirements-test-libraries.txt ; then echo PyQt5 >> requirements-test-libraries.txt ;fi
if grep -q sudachipy requirements-test-libraries.txt; then
echo sudachidict-small >> requirements-test-libraries.txt;
echo sudachidict-core >> requirements-test-libraries.txt;
echo sudachidict-full >> requirements-test-libraries.txt;
fi
cat requirements-test-libraries.txt
- name: Set up .NET Core for pythonnet tests
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.x'
# Install MariaDB Connector/C from official MariaDB Community Server
# repository. The version shipped with ubuntu-20.04 is too old for
# the "mariadb" python package.
- name: Install MariaDB Connector/C
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y wget apt-transport-https
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
echo "2d7291993f1b71b5dc84cc1d23a65a5e01e783aa765c2bf5ff4ab62814bb5da1 mariadb_repo_setup" | sha256sum -c -
chmod +x mariadb_repo_setup
sudo ./mariadb_repo_setup
sudo apt-get install -y libmariadb3 libmariadb-dev
- name: Install apt dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
# Set up a virtual screen (for GUI libraries and pynput).
sudo apt-get install libxcb-xkb-dev xvfb
Xvfb :99 & echo "DISPLAY=:99" >> $GITHUB_ENV
# Install PyQt5 (qtmodern) dependencies.
sudo apt-get install -y libxcb-image0 libxcb-keysyms1 libxcb-render-util0 \
libxkbcommon-x11-0 libxcb-icccm4 libxcb1 openssl \
libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
libxcb-shape0-dev libxcb-xkb-dev libopengl0 libegl1 \
libpulse0 libpulse-mainloop-glib0
# Install cairo dependencies.
sudo apt-get install -y libcairo2
# Install libdiscid (dependency of discid python package).
sudo apt-get install -y libdiscid0
# These are dependencies of gmsh
sudo apt-get install -y libglu1 libgl1 libxrender1 libxcursor1 libxft2 \
libxinerama1 libgomp1
- name: Install brew dependencies
if: startsWith(matrix.os, 'macos')
run: |
# Install cairo dependencies.
brew install cairo
# Install pango dependencies (weasyprint hook).
brew install pango
# Install libdiscid (dependency of discid python package).
brew install libdiscid
# Install lsl library for pylsl
brew install labstreaminglayer/tap/lsl
- name: Install dependencies
shell: bash
run: |
# Upgrade to the latest pip.
python -m pip install -U pip setuptools wheel
# Install hooks-contrib
pip install -e .
pip install --prefer-binary -r requirements-test-libraries.txt
# Install PyInstaller
pip install ${{ matrix.pyinstaller }}
- name: Run tests
run: pytest -v
# Conditionally enable slow tests, so that they are ran only if
# their corresponding packages are explicitly installed but not
# if they are installed as dependencies of some other package.
- name: Check if slow tests are required (scikit-learn)
id: check-scikit-learn
shell: bash
run: |
grep -E "scikit-learn" requirements-test-libraries.txt && echo "AVAILABLE=yes" >> $GITHUB_OUTPUT || echo "AVAILABLE=no" >> $GITHUB_OUTPUT
- name: Run slow tests (scikit-learn)
if: ${{ steps.check-scikit-learn.outputs.AVAILABLE == 'yes' }}
run: pytest -v -m slow -k sklearn
- name: Check if slow tests are required (scikit-image)
id: check-scikit-image
shell: bash
run: |
grep -E "scikit-image" requirements-test-libraries.txt && echo "AVAILABLE=yes" >> $GITHUB_OUTPUT || echo "AVAILABLE=no" >> $GITHUB_OUTPUT
- name: Run slow tests (scikit-image)
if: ${{ steps.check-scikit-image.outputs.AVAILABLE == 'yes' }}
run: pytest -v -m slow -k skimage