Skip to content

Commit

Permalink
Have GitHub build wheels on commit (#1758)
Browse files Browse the repository at this point in the history
  • Loading branch information
Czaki committed May 16, 2020
1 parent 84a4ac3 commit 1356286
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 6 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build wheel

on: [push, pull_request]

jobs:
wheel_without_test:
name: build wheel for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
env:
CIBW_SKIP: "pp27-*win* cp27-*manylinux* pp-*manylinux*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
name: Install Python 3.7
with:
python-version: '3.7'

- name: Install Visual C++ for Python 2.7
if: startsWith(matrix.os, 'windows')
run: |
choco install vcpython27 -f -y
- name: "install cibuildwheel"
run: pip install cibuildwheel==1.4.1

- name: build wheel
run: cibuildwheel .

- name: Upload wheels
uses: actions/upload-artifact@v1
with:
name: wheels2
path: wheelhouse

wheel:
name: build wheel for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
env:
CIBW_SKIP: "pp27-*win* *27* cp27-*manylinux* pp-*manylinux*"
CIBW_TEST_COMMAND: python -Wa {project}/psutil/tests/runner.py
CIBW_TEST_COMMAND_MACOS: LC_ALL='en_US.utf8' python -Wa {project}/psutil/tests/runner.py
CIBW_TEST_EXTRAS: test
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
name: Install Python 3.7
with:
python-version: '3.7'

- name: Install Visual C++ for Python 2.7
if: startsWith(matrix.os, 'windows')
run: |
choco install vcpython27 -f -y
- name: "install cibuildwheel"
run: pip install cibuildwheel==1.4.1

- name: build wheel
run: cibuildwheel .

- name: Upload wheels
uses: actions/upload-artifact@v1
with:
name: wheels
path: wheelhouse
7 changes: 5 additions & 2 deletions psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@
TRAVIS = bool(os.environ.get('TRAVIS'))
APPVEYOR = bool(os.environ.get('APPVEYOR'))
CIRRUS = bool(os.environ.get('CIRRUS'))
CI_TESTING = TRAVIS or APPVEYOR or CIRRUS
GITHUB_WHEELS = bool(os.environ.get('CIBUILDWHEEL', False))
CI_TESTING = TRAVIS or APPVEYOR or CIRRUS or GITHUB_WHEELS

# --- configurable defaults

Expand Down Expand Up @@ -199,7 +200,9 @@ def attempt(exe):
else:
return exe

if MACOS:
if GITHUB_WHEELS:
return which('python')
elif MACOS:
exe = \
attempt(sys.executable) or \
attempt(os.path.realpath(sys.executable)) or \
Expand Down
3 changes: 2 additions & 1 deletion psutil/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from psutil.tests import PYPY
from psutil.tests import retry_on_failure
from psutil.tests import TRAVIS
from psutil.tests import GITHUB_WHEELS
from psutil.tests import UNICODE_SUFFIX
from psutil.tests import unittest

Expand Down Expand Up @@ -618,7 +619,7 @@ def test_disk_partitions(self):
try:
os.stat(disk.mountpoint)
except OSError as err:
if TRAVIS and MACOS and err.errno == errno.EIO:
if (GITHUB_WHEELS or TRAVIS) and MACOS and err.errno == errno.EIO:
continue
# http://mail.python.org/pipermail/python-dev/
# 2012-June/120787.html
Expand Down
1 change: 1 addition & 0 deletions psutil/tests/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
from psutil.tests import terminate
from psutil.tests import TESTFN_PREFIX
from psutil.tests import TRAVIS
from psutil.tests import GITHUB_WHEELS
from psutil.tests import UNICODE_SUFFIX
from psutil.tests import unittest
import psutil
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@
sources.append('psutil/_psutil_posix.c')


extras_require = {}
if sys.version_info[:2] <= (3, 3):
extras_require.update(dict(enum='enum34'))
extras_require = {"test": [
"ipaddress; python_version < '3.0'",
"mock; python_version < '3.0'",
"pypiwin32; sys.platform == 'win32'",
"wmi; sys.platform == 'win32'",
"enum34; python_version <= '3.4'",]}


def get_version():
Expand Down

0 comments on commit 1356286

Please sign in to comment.