diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..6dfce6aa --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,29 @@ +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-latest] + python_version: ['3.7'] + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + name: Install Python ${{ matrix.python_version }} + with: + python-version: ${{ matrix.python_version }} + + - 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/CI.md b/CI.md index d01ca50c..cd964a41 100644 --- a/CI.md +++ b/CI.md @@ -1,10 +1,10 @@ This is a summary of the Python versions and platforms covered by the different CI platforms: -| | 3.5 | 3.6 | 3.7 | 3.8 | -|----------|------------------|------------------|-----------------------|------------------| -| Linux | Travis CI | CircleCI | AppVeyor | Azure Pipelines | -| macOS | Azure Pipelines | CircleCI | Travis CI¹ / CircleCI | Azure Pipelines | -| Windows | TravisCI | Azure Pipelines | AppVeyor | Azure Pipelines | +| | 3.5 | 3.6 | 3.7 | 3.8 | +|----------|------------------|------------------|---------------------------------------------------|------------------| +| Linux | Travis CI | CircleCI | AppVeyor / GitHub Actions | Azure Pipelines | +| macOS | Azure Pipelines | CircleCI | AppVeyor / Travis CI¹ / CircleCI / GitHub Actions | Azure Pipelines | +| Windows | TravisCI | Azure Pipelines | AppVeyor / GitHub Actions | Azure Pipelines | > ¹ Python version not really pinned, but dependent on the (default) version of image used. diff --git a/README.md b/README.md index 6a069aa3..29b5609c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ cibuildwheel Python wheels are great. Building them across **Mac, Linux, Windows**, on **multiple versions of Python**, is not. -`cibuildwheel` is here to help. `cibuildwheel` runs on your CI server - currently it supports Azure Pipelines, Travis CI, AppVeyor, and CircleCI - and it builds and tests your wheels across all of your platforms. +`cibuildwheel` is here to help. `cibuildwheel` runs on your CI server - currently it supports Azure Pipelines, Travis CI, AppVeyor, GitHub Actions and CircleCI - and it builds and tests your wheels across all of your platforms. What does it do? @@ -35,13 +35,14 @@ What does it do? Usage ----- -`cibuildwheel` currently works on **Travis CI**, **Azure Pipelines** and **AppVeyor** to build wheels for all three supported platforms (Linux, macOS, Windows). On **CircleCI** Linux and macOS wheels can be built. +`cibuildwheel` currently works on **Travis CI**, **Azure Pipelines**, **AppVeyor** and **GitHub Actions** to build wheels for all three supported platforms (Linux, macOS, Windows). On **CircleCI** Linux and macOS wheels can be built. | | Linux | macOS | Windows | |-----------------|-------|-------|---------| | Azure Pipelines | ✅ | ✅ | ✅ | | Travis CI | ✅ | ✅ | ✅ | | AppVeyor | ✅ | ✅ | ✅ | +| GitHub Actions | ✅ | ✅ | ✅ | | CircleCI | ✅ | ✅ | | `cibuildwheel` is not intended to run on your development machine. Because it uses system Python from Python.org it will try to install packages globally - not what you expect from a build tool! Instead, isolated CI services like Travis CI, CircleCI, Azure Pipelines and AppVeyor are ideal. @@ -76,7 +77,7 @@ env: # Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings install: - - python3 -m pip install cibuildwheel==1.2.0 + - python3 -m pip install cibuildwheel==1.3.0 script: # build the wheels, put them into './wheelhouse' @@ -141,6 +142,16 @@ This is similar to static linking, so it might have some licence implications. C Changelog ========= +### 1.3.0 + +_12 March 2020_ + +- ✨ Add support for building on Github Actions! Check out the + [docs](https://cibuildwheel.readthedocs.io/en/stable/setup/#github-actions) + for information on how to set it up. (#194) +- ✨ Add the `CIBW_BEFORE_TEST` option, which lets you run a command to + prepare the environment before your tests are run. (#242) + ### 1.2.0 _8 March 2020_ diff --git a/cibuildwheel/__init__.py b/cibuildwheel/__init__.py index 58d478ab..19b4f1d6 100644 --- a/cibuildwheel/__init__.py +++ b/cibuildwheel/__init__.py @@ -1 +1 @@ -__version__ = '1.2.0' +__version__ = '1.3.0' diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index ad41c485..3de75657 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -79,12 +79,12 @@ def main(): if args.platform != 'auto': platform = args.platform else: - ci = strtobool(os.environ.get('CI', 'false')) or 'BITRISE_BUILD_NUMBER' in os.environ or 'AZURE_HTTP_USER_AGENT' in os.environ + ci = strtobool(os.environ.get('CI', 'false')) or 'BITRISE_BUILD_NUMBER' in os.environ or 'AZURE_HTTP_USER_AGENT' in os.environ or 'GITHUB_WORKFLOW' in os.environ if not ci: print('cibuildwheel: Unable to detect platform. cibuildwheel should run on your CI server, ' - 'Travis CI, AppVeyor, Azure Pipelines and CircleCI are supported. You can run on your ' - 'development machine or other CI providers using the --platform argument. Check --help ' - 'output for more information.', + 'Travis CI, AppVeyor, Azure Pipelines, GitHub Actions and CircleCI are supported. You ' + 'can run on your development machine or other CI providers using the --platform argument. ' + 'Check --help output for more information.', file=sys.stderr) exit(2) if sys.platform.startswith('linux'): diff --git a/docs/setup.md b/docs/setup.md index 9f74269b..f8b201ed 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -2,9 +2,22 @@ title: 'Setup' --- +# GitHub Actions [linux/mac/windows] {: #github-actions} + +To build Linux, Mac, and Windows wheels using Github Actions, create a `.github/workflows/build.yml` file in your repo. + +> build.yml +```yaml +{% include "../examples/github-minimal.yml" %} +``` + +Commit this file, and push to Github - either to your default branch, or to a PR branch. The build should start automatically. + +For more info on this file, check out the [docs](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions). + # Azure Pipelines [linux/mac/windows] {: #azure-pipelines} -Using Azure pipelines, you can build all three platforms on the same service. Create a `azure-pipelines.yml` file in your repo. +To build Linux, Mac, and Windows wheels on Azure Pipelines, create a `azure-pipelines.yml` file in your repo. > azure-pipelines.yml ```yaml diff --git a/examples/appveyor-minimal.yml b/examples/appveyor-minimal.yml index 3b5625e1..3314fba6 100644 --- a/examples/appveyor-minimal.yml +++ b/examples/appveyor-minimal.yml @@ -12,7 +12,7 @@ stack: python 3.7 init: - cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH% -install: python -m pip install cibuildwheel==1.2.0 +install: python -m pip install cibuildwheel==1.3.0 build_script: python -m cibuildwheel --output-dir wheelhouse diff --git a/examples/azure-pipelines-minimal.yml b/examples/azure-pipelines-minimal.yml index d457e1b5..98cf1471 100644 --- a/examples/azure-pipelines-minimal.yml +++ b/examples/azure-pipelines-minimal.yml @@ -5,7 +5,7 @@ jobs: - task: UsePythonVersion@0 - bash: | python3 -m pip install --upgrade pip - pip3 install cibuildwheel==1.2.0 + pip3 install cibuildwheel==1.3.0 cibuildwheel --output-dir wheelhouse . - task: PublishBuildArtifacts@1 inputs: {pathtoPublish: 'wheelhouse'} @@ -16,7 +16,7 @@ jobs: - task: UsePythonVersion@0 - bash: | python3 -m pip install --upgrade pip - pip3 install cibuildwheel==1.2.0 + pip3 install cibuildwheel==1.3.0 cibuildwheel --output-dir wheelhouse . - task: PublishBuildArtifacts@1 inputs: {pathtoPublish: 'wheelhouse'} @@ -29,7 +29,7 @@ jobs: displayName: Install Visual C++ for Python 2.7 - bash: | python -m pip install --upgrade pip - pip install cibuildwheel==1.2.0 + pip install cibuildwheel==1.3.0 cibuildwheel --output-dir wheelhouse . - task: PublishBuildArtifacts@1 inputs: {pathtoPublish: 'wheelhouse'} diff --git a/examples/circleci-minimal.yml b/examples/circleci-minimal.yml index f76b011c..7748d362 100644 --- a/examples/circleci-minimal.yml +++ b/examples/circleci-minimal.yml @@ -11,7 +11,7 @@ jobs: - run: name: Build the Linux wheels. command: | - pip3 install --user cibuildwheel==1.2.0 + pip3 install --user cibuildwheel==1.3.0 cibuildwheel --output-dir wheelhouse - store_artifacts: path: wheelhouse/ @@ -25,7 +25,7 @@ jobs: - run: name: Build the OS X wheels. command: | - pip3 install --user cibuildwheel==1.2.0 + pip3 install --user cibuildwheel==1.3.0 cibuildwheel --output-dir wheelhouse - store_artifacts: path: wheelhouse/ diff --git a/examples/github-minimal.yml b/examples/github-minimal.yml new file mode 100644 index 00000000..30913057 --- /dev/null +++ b/examples/github-minimal.yml @@ -0,0 +1,37 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheel on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-18.04, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v1 + + - uses: actions/setup-python@v1 + name: Install Python + with: + python-version: '3.7' + + - name: Install cibuildwheel + run: | + python -m pip install cibuildwheel==1.3.0 + + - name: Install Visual C++ for Python 2.7 + if: startsWith(matrix.os, 'windows') + run: | + choco install vcpython27 -f -y + + - name: Build wheel + run: | + python -m cibuildwheel --output-dir wheelhouse + + - uses: actions/upload-artifact@v1 + with: + name: wheels + path: ./wheelhouse diff --git a/examples/travis-ci-deploy-only.yml b/examples/travis-ci-deploy-only.yml index f205bc76..a27968fe 100644 --- a/examples/travis-ci-deploy-only.yml +++ b/examples/travis-ci-deploy-only.yml @@ -25,7 +25,7 @@ env: # Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings install: - - python3 -m pip install cibuildwheel==1.2.0 + - python3 -m pip install cibuildwheel==1.3.0 script: # build the wheels, put them into './wheelhouse' diff --git a/examples/travis-ci-minimal.yml b/examples/travis-ci-minimal.yml index 2060444e..f5d4bc94 100644 --- a/examples/travis-ci-minimal.yml +++ b/examples/travis-ci-minimal.yml @@ -26,7 +26,7 @@ jobs: - ln -s /c/Python38/python.exe /c/Python38/python3.exe install: - - python3 -m pip install cibuildwheel==1.2.0 + - python3 -m pip install cibuildwheel==1.3.0 script: # build the wheels, put them into './wheelhouse' diff --git a/examples/travis-ci-test-and-deploy.yml b/examples/travis-ci-test-and-deploy.yml index 5a92634a..9fff17e0 100644 --- a/examples/travis-ci-test-and-deploy.yml +++ b/examples/travis-ci-test-and-deploy.yml @@ -56,7 +56,7 @@ jobs: - stage: deploy name: Build and deploy Linux wheels services: docker - install: python3 -m pip install cibuildwheel==1.2.0 + install: python3 -m pip install cibuildwheel==1.3.0 script: python3 -m cibuildwheel --output-dir wheelhouse after_success: | python3 -m pip install twine @@ -66,7 +66,7 @@ jobs: name: Build and deploy macOS wheels os: osx language: shell - install: python3 -m pip install cibuildwheel==1.2.0 + install: python3 -m pip install cibuildwheel==1.3.0 script: python3 -m cibuildwheel --output-dir wheelhouse after_success: | python3 -m pip install twine @@ -76,7 +76,7 @@ jobs: name: Build and deploy Windows wheels os: windows language: shell - install: python3 -m pip install cibuildwheel==1.2.0 + install: python3 -m pip install cibuildwheel==1.3.0 script: python3 -m cibuildwheel --output-dir wheelhouse after_success: | python3 -m pip install twine diff --git a/setup.py b/setup.py index e139d8fb..89fbce52 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ with io.open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f: setup( name='cibuildwheel', - version='1.2.0', + version='1.3.0', install_requires=['bashlex!=0.13'], description="Build Python wheels on CI with minimal configuration.", long_description=long_description, diff --git a/unit_test/main_tests/main_platform_test.py b/unit_test/main_tests/main_platform_test.py index dae0c596..5b33a4d5 100644 --- a/unit_test/main_tests/main_platform_test.py +++ b/unit_test/main_tests/main_platform_test.py @@ -11,6 +11,7 @@ def test_unknown_platform_non_ci(monkeypatch, capsys): monkeypatch.delenv('CI', raising=False) monkeypatch.delenv('BITRISE_BUILD_NUMBER', raising=False) monkeypatch.delenv('AZURE_HTTP_USER_AGENT', raising=False) + monkeypatch.delenv('GITHUB_WORKFLOW', raising=False) with pytest.raises(SystemExit) as exit: main()