|
| 1 | +name: Build and upload to PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + build_wheels: |
| 9 | + name: Build wheels on ${{ matrix.os }} |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ubuntu-18.04] #, windows-latest, macos-latest] |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - uses: actions/setup-python@v2 |
| 18 | + name: Install Python |
| 19 | + with: |
| 20 | + python-version: '3.8' |
| 21 | + |
| 22 | + - name: Install cibuildwheel |
| 23 | + run: | |
| 24 | + python -m pip install cibuildwheel |
| 25 | +
|
| 26 | + - name: Build wheels |
| 27 | + env: |
| 28 | + CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*" |
| 29 | + CIBW_MANYLINUX_X86_64_IMAGE: ghcr.io/deepmodeling/manylinux2010_x86_64_tensorflow |
| 30 | + CIBW_BEFORE_BUILD: pip install tensorflow |
| 31 | + CIBW_SKIP: "*-win32 *-manylinux_i686" |
| 32 | + run: | |
| 33 | + python -m cibuildwheel --output-dir wheelhouse |
| 34 | + - uses: actions/upload-artifact@v2 |
| 35 | + with: |
| 36 | + path: ./wheelhouse/*.whl |
| 37 | + |
| 38 | + build_sdist: |
| 39 | + name: Build source distribution |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v2 |
| 43 | + - uses: actions/setup-python@v2 |
| 44 | + name: Install Python |
| 45 | + with: |
| 46 | + python-version: '3.8' |
| 47 | + - run: pip install -U scikit-build tensorflow setuptools_scm |
| 48 | + - name: Build sdist |
| 49 | + run: python setup.py sdist |
| 50 | + |
| 51 | + - uses: actions/upload-artifact@v2 |
| 52 | + with: |
| 53 | + path: dist/*.tar.gz |
| 54 | + |
| 55 | + upload_pypi: |
| 56 | + needs: [build_wheels, build_sdist] |
| 57 | + runs-on: ubuntu-latest |
| 58 | + if: startsWith(github.event.ref, 'refs/tags/v') |
| 59 | + steps: |
| 60 | + - uses: actions/download-artifact@v2 |
| 61 | + with: |
| 62 | + name: artifact |
| 63 | + path: dist |
| 64 | + |
| 65 | + - uses: pypa/gh-action-pypi-publish@master |
| 66 | + with: |
| 67 | + user: __token__ |
| 68 | + password: ${{ secrets.pypi_password }} |
0 commit comments