1name: Build + Deploy 2 3on: 4 push: 5 branches: [master] 6 tags: ["v*.*.*"] 7 pull_request: 8 branches: [master] 9 release: 10 types: 11 - published 12 13env: 14 CIBW_TEST_COMMAND: python {package}/tests/tests.py -v 15 16jobs: 17 18 build_sdist: 19 name: Build Source Distribution 20 runs-on: ubuntu-latest 21 steps: 22 - uses: actions/checkout@v1 23 with: 24 submodules: true 25 - name: Set up Python 26 uses: actions/setup-python@v2 27 with: 28 python-version: "3.x" 29 - name: Install dependencies 30 run: pip install --upgrade setuptools twine 31 - name: Build sdist 32 run: python setup.py sdist 33 - name: Check metadata 34 run: twine check dist/*.zip 35 - uses: actions/upload-artifact@v2 36 with: 37 path: dist/*.zip 38 39 build_wheels: 40 name: ${{ matrix.type }} ${{ matrix.arch }} on ${{ matrix.os }} 41 runs-on: ${{ matrix.os }} 42 defaults: 43 run: 44 shell: bash 45 strategy: 46 fail-fast: false 47 matrix: 48 os: [macos-latest, windows-latest] 49 arch: [auto64] 50 build: ["*"] 51 include: 52 # the manylinux1 docker images only contain from python3.6 to 3.9 53 - os: ubuntu-latest 54 type: manylinux1 55 arch: auto 56 build: "cp{36,37,38,39}-*" 57 CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 58 CIBW_MANYLINUX_I686_IMAGE: manylinux1 59 # the manylinux2010 image also contains python 3.10 60 - os: ubuntu-latest 61 arch: auto 62 type: manylinux2010 63 build: "pp* cp310-*" 64 CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010 65 CIBW_MANYLINUX_I686_IMAGE: manylinux2010 66 67 - os: macos-latest 68 arch: universal2 69 build: "*" 70 71 - os: windows-latest 72 arch: auto32 73 build: "*" 74 steps: 75 - uses: actions/checkout@v2 76 with: 77 submodules: recursive 78 - name: Set up Python 79 uses: actions/setup-python@v2 80 with: 81 python-version: "3.x" 82 - name: Install dependencies 83 run: pip install cibuildwheel 84 - name: Build Wheels 85 run: python -m cibuildwheel --output-dir wheelhouse . 86 env: 87 CIBW_BUILD: ${{ matrix.build }} 88 CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.CIBW_MANYLINUX_I686_IMAGE }} 89 CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.CIBW_MANYLINUX_X86_64_IMAGE }} 90 CIBW_ARCHS: ${{ matrix.arch }} 91 - uses: actions/upload-artifact@v2 92 with: 93 path: wheelhouse/*.whl 94 95 build_arch_wheels: 96 name: py${{ matrix.python }} on ${{ matrix.arch }} 97 runs-on: ubuntu-latest 98 strategy: 99 matrix: 100 # aarch64 uses qemu so it's slow, build each py version in parallel jobs 101 python: [36, 37, 38, 39, 310] 102 arch: [aarch64] 103 steps: 104 - uses: actions/checkout@v2 105 with: 106 submodules: true 107 - uses: docker/setup-qemu-action@v1.2.0 108 with: 109 platforms: all 110 - name: Install dependencies 111 run: pip install cibuildwheel 112 - name: Build Wheels 113 run: python -m cibuildwheel --output-dir wheelhouse . 114 env: 115 CIBW_BUILD: cp${{ matrix.python }}-* 116 CIBW_ARCHS: ${{ matrix.arch }} 117 - uses: actions/upload-artifact@v2 118 with: 119 path: wheelhouse/*.whl 120 121 deploy: 122 name: Upload if release 123 needs: [build_wheels, build_arch_wheels, build_sdist] 124 runs-on: ubuntu-latest 125 if: github.event_name == 'release' && github.event.action == 'published' 126 127 steps: 128 - uses: actions/download-artifact@v2 129 with: 130 name: artifact 131 path: dist 132 133 - uses: pypa/gh-action-pypi-publish@v1.4.2 134 with: 135 user: __token__ 136 password: ${{ secrets.PYPI_PASSWORD }} 137