|
| 1 | +name: Wheels |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + release: |
| 10 | + types: |
| 11 | + - published |
| 12 | + |
| 13 | +env: |
| 14 | + CIBW_TEST_COMMAND: python {project}/tests/test.py |
| 15 | + |
| 16 | + |
| 17 | +jobs: |
| 18 | + build_sdist: |
| 19 | + name: Build SDist |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + with: |
| 24 | + submodules: true |
| 25 | + |
| 26 | + - uses: actions/setup-python@v2 |
| 27 | + |
| 28 | + - name: Install deps |
| 29 | + run: python -m pip install twine build |
| 30 | + |
| 31 | + - name: Build SDist |
| 32 | + run: python -m build -s |
| 33 | + |
| 34 | + - name: Check metadata |
| 35 | + run: twine check dist/* |
| 36 | + |
| 37 | + - uses: actions/upload-artifact@v2 |
| 38 | + with: |
| 39 | + path: dist/*.tar.gz |
| 40 | + |
| 41 | + |
| 42 | + build_wheels: |
| 43 | + name: Wheels on ${{ matrix.os }} |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 49 | + |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v2 |
| 52 | + with: |
| 53 | + submodules: true |
| 54 | + |
| 55 | + - uses: actions/setup-python@v2 |
| 56 | + |
| 57 | + - name: Install cibuildwheel |
| 58 | + run: python -m pip install cibuildwheel==1.6.3 |
| 59 | + |
| 60 | + - name: Build wheel |
| 61 | + run: python -m cibuildwheel --output-dir wheelhouse |
| 62 | + env: |
| 63 | + # Python 2.7 on Windows requires a workaround for C++11 support, |
| 64 | + # built separately below |
| 65 | + CIBW_SKIP: cp27-win* |
| 66 | + |
| 67 | + - name: Show files |
| 68 | + run: ls -lh wheelhouse |
| 69 | + shell: bash |
| 70 | + |
| 71 | + - name: Verify clean directory |
| 72 | + run: git diff --exit-code |
| 73 | + shell: bash |
| 74 | + |
| 75 | + - name: Upload wheels |
| 76 | + uses: actions/upload-artifact@v2 |
| 77 | + with: |
| 78 | + path: wheelhouse/*.whl |
| 79 | + |
| 80 | + |
| 81 | + # Windows 2.7 (requires workaround for MSVC 2008 replacement) |
| 82 | + build_win27_wheels: |
| 83 | + name: Py 2.7 wheels on Windows |
| 84 | + runs-on: windows-latest |
| 85 | + |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v2 |
| 88 | + with: |
| 89 | + submodules: true |
| 90 | + |
| 91 | + - uses: actions/setup-python@v2 |
| 92 | + |
| 93 | + - name: Install cibuildwheel |
| 94 | + run: python -m pip install cibuildwheel==1.6.3 |
| 95 | + |
| 96 | + - uses: ilammy/msvc-dev-cmd@v1 |
| 97 | + |
| 98 | + - name: Build 64-bit wheel |
| 99 | + run: python -m cibuildwheel --output-dir wheelhouse |
| 100 | + env: |
| 101 | + CIBW_BUILD: cp27-win_amd64 |
| 102 | + DISTUTILS_USE_SDK: 1 |
| 103 | + MSSdk: 1 |
| 104 | + |
| 105 | + - uses: ilammy/msvc-dev-cmd@v1 |
| 106 | + with: |
| 107 | + arch: x86 |
| 108 | + |
| 109 | + - name: Build 32-bit wheel |
| 110 | + run: python -m cibuildwheel --output-dir wheelhouse |
| 111 | + env: |
| 112 | + CIBW_BUILD: cp27-win32 |
| 113 | + DISTUTILS_USE_SDK: 1 |
| 114 | + MSSdk: 1 |
| 115 | + |
| 116 | + - name: Show files |
| 117 | + run: ls -lh wheelhouse |
| 118 | + shell: bash |
| 119 | + |
| 120 | + - name: Verify clean directory |
| 121 | + run: git diff --exit-code |
| 122 | + shell: bash |
| 123 | + |
| 124 | + - uses: actions/upload-artifact@v2 |
| 125 | + with: |
| 126 | + path: wheelhouse/*.whl |
| 127 | + |
| 128 | + |
| 129 | + upload_all: |
| 130 | + name: Upload if release |
| 131 | + needs: [build_wheels, build_win27_wheels, build_sdist] |
| 132 | + runs-on: ubuntu-latest |
| 133 | + if: github.event_name == 'release' && github.event.action == 'published' |
| 134 | + |
| 135 | + steps: |
| 136 | + - uses: actions/setup-python@v2 |
| 137 | + |
| 138 | + - uses: actions/download-artifact@v2 |
| 139 | + with: |
| 140 | + name: artifact |
| 141 | + path: dist |
| 142 | + |
| 143 | + |
| 144 | + with: |
| 145 | + user: __token__ |
| 146 | + password: ${{ secrets.pypi_password }} |
0 commit comments