diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3c8ebd4e..b2e28e08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,8 +18,8 @@ jobs: os: [ubuntu-18.04, windows-latest, macos-latest] python_version: ['3.7'] steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 name: Install Python ${{ matrix.python_version }} with: python-version: ${{ matrix.python_version }} @@ -28,7 +28,7 @@ jobs: run: | python -m pip install -r requirements-dev.txt - name: Install Visual C++ for Python 2.7 - if: startsWith(matrix.os, 'windows') + if: runner.os == 'Windows' run: | choco install vcpython27 -f -y - name: Test cibuildwheel diff --git a/docs/deliver-to-pypi.md b/docs/deliver-to-pypi.md index 15d2317e..35d36062 100644 --- a/docs/deliver-to-pypi.md +++ b/docs/deliver-to-pypi.md @@ -33,4 +33,4 @@ Obviously, manual steps are for chumps, so we can automate this a little by usin If you don't need much control over the release of a package, you can set up cibuildwheel to deliver the wheels straight to PyPI. This doesn't require anycloud storage to work - you just need to bump the version and tag it. -Check out [this example repo](https://github.com/joerick/cibuildwheel-autopypi-example) for instructions on how to set this up. +[`examples/travis-deploy.yml`](https://github.com/joerick/cibuildwheel/blob/master/examples/travis-deploy.yml) and [`examples/github-deploy.yml`](https://github.com/joerick/cibuildwheel/blob/master/examples/travis-deploy.yml) are example configurations that automatocially upload wheels to PyPI. Also check out [this example repo](https://github.com/joerick/cibuildwheel-autopypi-example) for more detailed instructions on how to set this up. diff --git a/docs/setup.md b/docs/setup.md index f8b201ed..1ff2bc55 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -15,6 +15,8 @@ Commit this file, and push to Github - either to your default branch, or to a PR For more info on this file, check out the [docs](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions). +[`examples/github-deploy.yml`](https://github.com/joerick/cibuildwheel/blob/master/examples/github-deploy.yml) extends this minimal example with a demonstration of how to automatically upload the built wheels to PyPI. + # Azure Pipelines [linux/mac/windows] {: #azure-pipelines} To build Linux, Mac, and Windows wheels on Azure Pipelines, create a `azure-pipelines.yml` file in your repo. @@ -46,6 +48,8 @@ Commit this file, enable building of your repo on Travis CI, and push. Then setup a deployment method by following the [Travis CI deployment docs](https://docs.travis-ci.com/user/deployment/), or see [Delivering to PyPI](deliver-to-pypi.md). For more info on `.travis.yml`, check out the [docs](https://docs.travis-ci.com/). +[`examples/travis-deploy.yml`](https://github.com/joerick/cibuildwheel/blob/master/examples/travis-deploy.yml) extends this minimal example with a demonstration of how to automatically upload the built wheels to PyPI. + # CircleCI [linux/mac] {: #circleci} To build Linux and Mac wheels on CircleCI, create a `.circleci/config.yml` file in your repo, diff --git a/examples/github-deploy.yml b/examples/github-deploy.yml new file mode 100644 index 00000000..746c5847 --- /dev/null +++ b/examples/github-deploy.yml @@ -0,0 +1,81 @@ +name: Build and upload to PyPI + +# Build on every branch push, tag push, and pull request change: +on: [push, pull_request] +# Alternatively, to publish when a (published) GitHub Release is created, use the following: +# on: +# push: +# pull_request: +# release: +# types: +# - published + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-18.04, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.7' + + - name: Install cibuildwheel + run: | + python -m pip install cibuildwheel==1.4.2 + + - name: Install Visual C++ for Python 2.7 + if: runner.os == 'Windows' + run: | + choco install vcpython27 -f -y + + - name: Build wheels + run: | + python -m cibuildwheel --output-dir wheelhouse + + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.7' + + - name: Build sdist + run: python setup.py sdist + + - uses: actions/upload-artifact@v2 + with: + path: dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + # upload to PyPI on every tag starting with 'v' + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') + # alternatively, to publish when a GitHub Release is created, use the following rule: + # if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} + # To test: repository_url: https://test.pypi.org/legacy/ diff --git a/examples/github-minimal.yml b/examples/github-minimal.yml index 2b4e801d..8501cb84 100644 --- a/examples/github-minimal.yml +++ b/examples/github-minimal.yml @@ -4,34 +4,33 @@ on: [push, pull_request] jobs: build_wheels: - name: Build wheel on ${{ matrix.os }} + name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-18.04, windows-latest, macos-latest] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 - name: Install Python - with: - python-version: '3.7' + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.7' - - name: Install cibuildwheel - run: | - python -m pip install cibuildwheel==1.4.2 + - name: Install cibuildwheel + run: | + python -m pip install cibuildwheel==1.4.2 - - name: Install Visual C++ for Python 2.7 - if: startsWith(matrix.os, 'windows') - run: | - choco install vcpython27 -f -y + - name: Install Visual C++ for Python 2.7 + if: runner.os == 'Windows' + run: | + choco install vcpython27 -f -y - - name: Build wheel - run: | - python -m cibuildwheel --output-dir wheelhouse + - name: Build wheels + run: | + python -m cibuildwheel --output-dir wheelhouse - - uses: actions/upload-artifact@v1 - with: - name: wheels - path: ./wheelhouse + - uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl diff --git a/examples/travis-ci-deploy-only.yml b/examples/travis-ci-deploy.yml similarity index 100% rename from examples/travis-ci-deploy-only.yml rename to examples/travis-ci-deploy.yml