Skip to content

Commit eb2f74c

Browse files
authored
Fix CI tests / wheels / workflow (#2024)
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
1 parent a1ae994 commit eb2f74c

11 files changed

Lines changed: 75 additions & 31 deletions

File tree

.github/workflows/build.yml

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
#
44
# * Linux
55
# * macOS
6-
# * Windows (commented)
6+
# * Windows (disabled)
77
# * FreeBSD
88
#
99
# To skip certain builds see:
1010
# https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip
1111
#
1212
# External GH actions:
13+
# * https://github.com/pypa/cibuildwheel
1314
# * https://github.com/actions/checkout
1415
# * https://github.com/actions/setup-python
1516
# * https://github.com/actions/upload-artifact
@@ -19,10 +20,11 @@
1920
on: [push, pull_request]
2021
name: build
2122
jobs:
22-
linux-macos-win:
23-
name: ${{ matrix.os }}
23+
# Linux + macOS + Python 3
24+
linux-macos-py3:
25+
name: ${{ matrix.os }}-py3
2426
runs-on: ${{ matrix.os }}
25-
timeout-minutes: 30
27+
timeout-minutes: 20
2628
strategy:
2729
fail-fast: false
2830
matrix:
@@ -35,11 +37,12 @@ jobs:
3537
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/runner.py &&
3638
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/test_memleaks.py
3739
CIBW_TEST_EXTRAS: test
38-
CIBW_SKIP: cp35-* pp*
40+
CIBW_BUILD: 'cp37-* cp38-* cp39-* cp310-*'
41+
CIBW_SKIP: '*-musllinux_*'
3942

4043
steps:
4144
- name: Cancel previous runs
42-
uses: styfle/cancel-workflow-action@0.6.0
45+
uses: styfle/cancel-workflow-action@0.9.1
4346
with:
4447
access_token: ${{ github.token }}
4548

@@ -73,6 +76,57 @@ jobs:
7376
mv dist/psutil*.tar.gz wheelhouse/
7477
python scripts/internal/print_hashes.py wheelhouse/
7578
79+
# Linux + macOS + Python 2
80+
linux-macos-py2:
81+
name: ${{ matrix.os }}-py2
82+
runs-on: ubuntu-latest
83+
timeout-minutes: 20
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
os: [ubuntu-latest, macos-latest]
88+
include:
89+
- {name: Linux, python: '3.9', os: ubuntu-latest}
90+
env:
91+
CIBW_ARCHS: 'x86_64 i686'
92+
CIBW_TEST_COMMAND:
93+
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/runner.py &&
94+
PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 python {project}/psutil/tests/test_memleaks.py
95+
CIBW_TEST_EXTRAS: test
96+
CIBW_BUILD: 'cp27-*'
97+
CIBW_SKIP: '*-musllinux_*'
98+
99+
steps:
100+
- name: Cancel previous runs
101+
uses: styfle/cancel-workflow-action@0.9.1
102+
with:
103+
access_token: ${{ github.token }}
104+
105+
- uses: actions/checkout@v2
106+
- uses: actions/setup-python@v2
107+
with:
108+
python-version: 3.9
109+
110+
- name: Install cibuildwheel
111+
run: pip install cibuildwheel==1.12.0
112+
113+
- name: Run tests
114+
run: cibuildwheel .
115+
116+
- name: Create wheels
117+
uses: actions/upload-artifact@v2
118+
with:
119+
name: wheels
120+
path: wheelhouse
121+
122+
- name: Print hashes
123+
if: matrix.os == 'ubuntu-latest'
124+
run: |
125+
make generate-manifest
126+
python setup.py sdist
127+
mv dist/psutil*.tar.gz wheelhouse/
128+
python scripts/internal/print_hashes.py wheelhouse/
129+
76130
freebsd:
77131
runs-on: macos-latest
78132
steps:

HISTORY.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
*Bug tracker at https://github.com/giampaolo/psutil/issues*
22

3-
5.8.1 (IN DEVELOPMENT)
3+
5.9.0 (IN DEVELOPMENT)
44
======================
55

66
XXXX-XX-XX

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ INSTALL_OPTS = `$(PYTHON) -c \
4141
"import sys; print('' if hasattr(sys, 'real_prefix') else '--user')"`
4242
TEST_PREFIX = PYTHONWARNINGS=always PSUTIL_DEBUG=1
4343

44-
all: test
44+
all: help
4545

4646
# ===================================================================
4747
# Install
@@ -214,9 +214,11 @@ install-git-hooks: ## Install GIT pre-commit hook.
214214

215215
download-wheels-github: ## Download latest wheels hosted on github.
216216
$(PYTHON) scripts/internal/download_wheels_github.py --tokenfile=~/.github.token
217+
${MAKE} print-wheels
217218

218219
download-wheels-appveyor: ## Download latest wheels hosted on appveyor.
219220
$(PYTHON) scripts/internal/download_wheels_appveyor.py
221+
${MAKE} print-wheels
220222

221223
print-wheels: ## Print downloaded wheels
222224
$(PYTHON) scripts/internal/print_wheels.py

appveyor.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ environment:
2424
PYTHON_VERSION: "2.7.x"
2525
PYTHON_ARCH: "32"
2626

27-
- PYTHON: "C:\\Python36"
28-
PYTHON_VERSION: "3.6.x"
29-
PYTHON_ARCH: "32"
30-
3127
- PYTHON: "C:\\Python37"
3228
PYTHON_VERSION: "3.7.x"
3329
PYTHON_ARCH: "32"
@@ -52,10 +48,6 @@ environment:
5248
PYTHON_VERSION: "2.7.x"
5349
PYTHON_ARCH: "64"
5450

55-
- PYTHON: "C:\\Python36-x64"
56-
PYTHON_VERSION: "3.6.x"
57-
PYTHON_ARCH: "64"
58-
5951
- PYTHON: "C:\\Python37-x64"
6052
PYTHON_VERSION: "3.7.x"
6153
PYTHON_ARCH: "64"

psutil/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
AF_LINK = _psplatform.AF_LINK
211211

212212
__author__ = "Giampaolo Rodola'"
213-
__version__ = "5.8.1"
213+
__version__ = "5.9.0"
214214
version_info = tuple([int(num) for num in __version__.split('.')])
215215

216216
_timer = getattr(time, 'monotonic', time.time)

psutil/tests/runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ def warn(msg):
298298

299299
# Used by test_*,py modules.
300300
def run_from_name(name):
301+
if CI_TESTING:
302+
print_sysinfo()
301303
suite = TestLoader().from_name(name)
302304
runner = get_runner()
303305
runner.run(suite)

psutil/tests/test_connections.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import os
1010
import socket
11-
import sys
1211
import textwrap
1312
from contextlib import closing
1413
from socket import AF_INET
@@ -47,7 +46,6 @@
4746

4847
thisproc = psutil.Process()
4948
SOCK_SEQPACKET = getattr(socket, "SOCK_SEQPACKET", object())
50-
PYTHON_39 = sys.version_info[:2] == (3, 9)
5149

5250

5351
@serialrun

psutil/tests/test_linux.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def free_swap():
149149
"""Parse 'free' cmd and return swap memory's s total, used and free
150150
values.
151151
"""
152-
out = sh('free -b', env={"LANG": "C.UTF-8"})
152+
out = sh(["free", "-b"], env={"LANG": "C.UTF-8"})
153153
lines = out.split('\n')
154154
for line in lines:
155155
if line.startswith('Swap'):
@@ -168,7 +168,7 @@ def free_physmem():
168168
# and 'cached' memory which may have different positions so we
169169
# do not return them.
170170
# https://github.com/giampaolo/psutil/issues/538#issuecomment-57059946
171-
out = sh('free -b', env={"LANG": "C.UTF-8"})
171+
out = sh(["free", "-b"], env={"LANG": "C.UTF-8"})
172172
lines = out.split('\n')
173173
for line in lines:
174174
if line.startswith('Mem'):
@@ -182,7 +182,7 @@ def free_physmem():
182182

183183

184184
def vmstat(stat):
185-
out = sh("vmstat -s", env={"LANG": "C.UTF-8"})
185+
out = sh(["vmstat", "-s"], env={"LANG": "C.UTF-8"})
186186
for line in out.split("\n"):
187187
line = line.strip()
188188
if stat in line:
@@ -191,7 +191,7 @@ def vmstat(stat):
191191

192192

193193
def get_free_version_info():
194-
out = sh("free -V").strip()
194+
out = sh(["free", "-V"]).strip()
195195
if 'UNKNOWN' in out:
196196
raise unittest.SkipTest("can't determine free version")
197197
return tuple(map(int, out.split()[-1].split('.')))
@@ -312,7 +312,7 @@ def test_shared(self):
312312
def test_available(self):
313313
# "free" output format has changed at some point:
314314
# https://github.com/giampaolo/psutil/issues/538#issuecomment-147192098
315-
out = sh("free -b")
315+
out = sh(["free", "-b"])
316316
lines = out.split('\n')
317317
if 'available' not in lines[0]:
318318
raise unittest.SkipTest("free does not support 'available' column")

psutil/tests/test_misc.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import pickle
1818
import socket
1919
import stat
20-
import sys
2120

2221
from psutil import LINUX
2322
from psutil import POSIX
@@ -50,9 +49,6 @@
5049
import psutil.tests
5150

5251

53-
PYTHON_39 = sys.version_info[:2] == (3, 9)
54-
55-
5652
# ===================================================================
5753
# --- Misc / generic tests.
5854
# ===================================================================
@@ -414,7 +410,7 @@ def test_debug(self):
414410
msg = f.getvalue()
415411
assert msg.startswith("psutil-debug"), msg
416412
self.assertIn("hello", msg)
417-
self.assertIn(__file__, msg)
413+
self.assertIn(__file__.replace('.pyc', '.py'), msg)
418414

419415
# supposed to use repr(exc)
420416
with redirect_stderr(StringIO()) as f:

scripts/internal/download_wheels_appveyor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
USER = "giampaolo"
2727
PROJECT = "psutil"
2828
BASE_URL = 'https://ci.appveyor.com/api'
29-
PY_VERSIONS = ['2.7', '3.6', '3.7', '3.8', '3.9']
29+
PY_VERSIONS = ['2.7', '3.7', '3.8', '3.9', '3.10']
3030
TIMEOUT = 30
3131

3232

0 commit comments

Comments
 (0)