forked from cloudpipe/cloudpickle
245 lines (235 loc) · 8.99 KB
/
testing.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Automated Tests
on:
push:
branches: master
pull_request:
branches: master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install flake8
shell: bash
run: |
python -V
python -m pip install flake8
- name: Run flake8 on diff with upstream/master
shell: bash
run: |
bash ./.github/scripts/flake8_diff.sh
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python_version: [3.5, 3.6, 3.7, 3.8, 3.9, "pypy3"]
exclude:
# Do not test all minor versions on all platforms, especially if they
# are not the oldest/newest supported versions
- os: windows-latest
python_version: 3.6
- os: windows-latest
python_version: 3.7
- os: windows-latest
python_version: 3.8
# as of 4/02/2020, psutil won't build under PyPy + Windows
- os: windows-latest
python_version: "pypy3"
- os: macos-latest
python_version: 3.6
- os: macos-latest
python_version: 3.7
- os: macos-latest
python_version: 3.8
- os: macos-latest
# numpy triggers: RuntimeError: Polyfit sanity test emitted a
# warning
python_version: "pypy3"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install project and dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install -r dev-requirements.txt
python ci/install_coverage_subprocess_pth.py
export
- name: Install supported dependencies (only test in Python 3.6)
shell: bash
run: python -m pip install typing-extensions
if: matrix.python_version == '3.6'
- name: Display Python version
shell: bash
run: python -c "import sys; print(sys.version)"
- name: Look for syntax errors/undefined names
shell: bash
run: |
python -m flake8 . --count --verbose --select=E901,E999,F821,F822,F823 \
--show-source --statistics
- name: Test with pytest
shell: bash
run: |
COVERAGE_PROCESS_START=$GITHUB_WORKSPACE/.coveragerc \
PYTHONPATH='.:tests' python -m pytest -r s
coverage combine --append
coverage xml -i
- name: Publish coverage results
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
python-nightly:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Install Python from ppa:deadsnakes/nightly
run: |
sudo add-apt-repository ppa:deadsnakes/nightly
sudo apt update
sudo apt install python3.10 python3.10-venv python3.10-dev
python3.10 -m venv nightly-venv
echo "$PWD/nightly-venv/bin" >> $GITHUB_PATH
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install project and dependencies
run: |
set -e
python -m pip install --upgrade pip
python -m pip install -r dev-requirements.txt
python -m pip install -e .
python ci/install_coverage_subprocess_pth.py
- name: Generate old pickles (backward compat)
shell: bash
run: |
git_head=$(git rev-parse HEAD)
cp tests/generate_old_pickles.py tests/_generate_old_pickles.py
git checkout v1.4.1
python tests/_generate_old_pickles.py
git checkout ${git_head}
- name: Test with pytest
run: |
COVERAGE_PROCESS_START=$GITHUB_WORKSPACE/.coveragerc \
PYTHONPATH='.:tests' python -m pytest -r s
coverage combine --append
coverage xml -i
- name: Publish coverage results
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
distributed-downstream-build:
runs-on: ubuntu-latest
if: "contains(github.event.pull_request.labels.*.name, 'ci distributed') || contains(github.event.pull_request.labels.*.name, 'ci downstream')"
env:
PROJECT: distributed
TEST_REQUIREMENTS: pytest pytest-timeout numpy pandas mock bokeh fsspec>=0.3.3
PROJECT_URL: https://github.com/dask/distributed.git
PYTEST_ADDOPTS: "--timeout-method=thread --timeout=300 -m \"not avoid_travis\" -k \"not test_dask_scheduler and not test_workspace_concurrency and not test_defaults and not test_service_hosts and not test_logging_file_config and not test_hostport and not test_workdir_simple and not test_two_workspaces_in_same_directory and not test_recompute_released_results and not test_connection_args and not test_listen_args and not test_remote_access\""
strategy:
matrix:
python_version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install project and dependencies
run: |
bash ./.github/scripts/install_downstream_project.sh
- name: Test the downstream project
run: |
bash ./.github/scripts/test_downstream_project.sh
joblib-downstream-build:
runs-on: ubuntu-latest
if: "contains(github.event.pull_request.labels.*.name, 'ci joblib') || contains(github.event.pull_request.labels.*.name, 'ci downstream')"
env:
PROJECT: joblib
TEST_REQUIREMENTS: "threadpoolctl pytest numpy distributed"
PROJECT_URL: https://github.com/joblib/joblib.git
strategy:
matrix:
python_version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install project and dependencies
run: |
bash ./.github/scripts/install_downstream_project.sh
- name: Vendor current cloudpickle inside joblib
run: |
pushd ../joblib/joblib/externals
source vendor_cloudpickle.sh ../../../cloudpickle
popd
- name: Test the downstream project
run: |
bash ./.github/scripts/test_downstream_project.sh
loky-downstream-build:
runs-on: ubuntu-latest
if: "contains(github.event.pull_request.labels.*.name, 'ci loky') || contains(github.event.pull_request.labels.*.name, 'ci downstream')"
env:
PROJECT: loky
TEST_REQUIREMENTS: "pytest psutil"
PROJECT_URL: https://github.com/tomMoral/loky.git
strategy:
matrix:
python_version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install project and dependencies
run: |
bash ./.github/scripts/install_downstream_project.sh
- name: Test the downstream project
run: |
bash ./.github/scripts/test_downstream_project.sh
ray-downstream-build:
runs-on: ubuntu-latest
if: "contains(github.event.pull_request.labels.*.name, 'ci ray') || contains(github.event.pull_request.labels.*.name, 'ci downstream')"
env:
PROJECT: ray
strategy:
matrix:
python_version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}
- name: Install project and dependencies
run: |
python -m pip install --upgrade -r dev-requirements.txt
python -m pip install setproctitle psutil ray==0.8.6
PROJECT_DIR=$(python -c "import os, ray; print(os.path.dirname(ray.__file__), flush=True)")
rm $PROJECT_DIR/cloudpickle/cloudpickle.py
git clone https://github.com/ray-project/ray.git ../ray
cp -R ../ray/python/ray/tests $PROJECT_DIR/tests
cp cloudpickle/cloudpickle.py $PROJECT_DIR/cloudpickle/cloudpickle.py
cp cloudpickle/compat.py $PROJECT_DIR/cloudpickle/compat.py
cp cloudpickle/cloudpickle_fast.py $PROJECT_DIR/cloudpickle/cloudpickle_fast.py
- name: Test the downstream project
run: |
PROJECT_DIR="$(python -c "import os, ray; print(os.path.dirname(ray.__file__), flush=True)")"
COVERAGE_PROCESS_START="$TRAVIS_BUILD_DIR/.coveragerc" PYTHONPATH='.:tests' pytest -r s
pytest -vl $PROJECT_DIR/tests/test_serialization.py::test_simple_serialization
pytest -vl $PROJECT_DIR/tests/test_serialization.py::test_complex_serialization
pytest -vl $PROJECT_DIR/tests/test_basic.py::test_ray_recursive_objects
pytest -vl $PROJECT_DIR/tests/test_serialization.py::test_serialization_final_fallback
pytest -vl $PROJECT_DIR/tests/test_basic.py::test_nested_functions