diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..c4a96b1bd --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Test + +on: [push, pull_request] + +jobs: + test: + name: Test cibuildwheel on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-18.04, windows-latest, macOS-10.14] + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + name: Install Python ${{ matrix.python_version }} + with: + python-version: "3.7" + + - name: Install dependencies + run: | + python -m pip install -r requirements-dev.txt + - name: Install Visual C++ for Python 2.7 + if: startsWith(matrix.os, 'windows') + run: | + choco install vcpython27 -f -y + - name: Test cibuildwheel + run: | + python ./bin/run_tests.py diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index 67d908270..c268fca35 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -83,6 +83,13 @@ def main(): platform = 'macos' elif os.environ['AGENT_OS'] == 'Windows_NT': platform = 'windows' + elif 'GITHUB_WORKFLOW' in os.environ: + if sys.platform.startswith('linux'): + platform = 'linux' + elif sys.platform.startswith('darwin'): + platform = 'macos' + else: + platform = 'windows' if platform is None: print('cibuildwheel: Unable to detect platform. cibuildwheel should run on your CI server, ' diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index d37d75097..bd6247162 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -16,8 +16,9 @@ from .util import prepare_command, get_build_verbosity_extra_flags -IS_RUNNING_ON_AZURE = os.path.exists('C:\\hostedtoolcache') +IS_RUNNING_ON_GITHUB = os.environ.get('GITHUB_WORKFLOW', None) is not None IS_RUNNING_ON_TRAVIS = os.environ.get('TRAVIS_OS_NAME') == 'windows' +IS_RUNNING_ON_APPVEYOR = os.environ.get('APPVEYOR', 'false').lower() == 'true' def get_python_path(config): @@ -51,6 +52,9 @@ def get_python_configurations(build_selector): # try with (and similar): msiexec /i VCForPython27.msi ALLUSERS=1 ACCEPT=YES /passive python_configurations = [c for c in python_configurations if not c.version.startswith('2.7.')] + if IS_RUNNING_ON_GITHUB: + python_configurations = [c for c in python_configurations if not c.version.startswith('3.5.')] + # skip builds as required python_configurations = [c for c in python_configurations if build_selector(c.identifier)] @@ -71,11 +75,8 @@ def download(url, dest): file.write(response.read()) finally: response.close() - if IS_RUNNING_ON_AZURE or IS_RUNNING_ON_TRAVIS: - shell = simple_shell - else: + if IS_RUNNING_ON_APPVEYOR: run_with_env = os.path.abspath(os.path.join(os.path.dirname(__file__), 'resources', 'appveyor_run_with_env.cmd')) - # run_with_env is a cmd file that sets the right environment variables # to build on AppVeyor. def shell(args, env=None, cwd=None): @@ -83,6 +84,8 @@ def shell(args, env=None, cwd=None): print('+ ' + ' '.join(args)) args = ['cmd', '/E:ON', '/V:ON', '/C', run_with_env] + args return subprocess.check_call(' '.join(args), env=env, cwd=cwd) + else: + shell = simple_shell abs_project_dir = os.path.abspath(project_dir) temp_dir = tempfile.mkdtemp(prefix='cibuildwheel') diff --git a/test/shared/utils.py b/test/shared/utils.py index d4e9c9c62..3a9734769 100644 --- a/test/shared/utils.py +++ b/test/shared/utils.py @@ -6,7 +6,8 @@ import subprocess, sys, os -IS_WINDOWS_RUNNING_ON_AZURE = os.path.exists('C:\\hostedtoolcache') + +IS_WINDOWS_RUNNING_ON_GITHUB = os.path.exists('C:\\hostedtoolcache') and os.environ.get('GITHUB_WORKFLOW', None) is not None IS_WINDOWS_RUNNING_ON_TRAVIS = os.environ.get('TRAVIS_OS_NAME') == 'windows' @@ -102,6 +103,10 @@ def expected_wheels(package_name, package_version): # Python 2.7 isn't supported on Travis. templates = [t for t in templates if '-cp27-' not in t] + if IS_WINDOWS_RUNNING_ON_GITHUB: + # Python 3.5 isn't supported on GitHub. + templates = [t for t in templates if '-cp35-' not in t] + return [filename.format(package_name=package_name, package_version=package_version) for filename in templates]