build-wheels-linux.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. name: build-wheels-linux
  2. on:
  3. push:
  4. branches:
  5. - wheel
  6. tags:
  7. - '*'
  8. workflow_dispatch:
  9. env:
  10. SHERPA_NCNN_IS_IN_GITHUB_ACTIONS: 1
  11. concurrency:
  12. group: build-wheels-linux-${{ github.ref }}
  13. cancel-in-progress: true
  14. jobs:
  15. build_wheels_linux:
  16. name: ${{ matrix.python-version }}
  17. runs-on: ${{ matrix.os }}
  18. strategy:
  19. fail-fast: false
  20. matrix:
  21. os: [ubuntu-latest]
  22. python-version: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]
  23. steps:
  24. - uses: actions/checkout@v2
  25. # see https://cibuildwheel.readthedocs.io/en/stable/changelog/
  26. # for a list of versions
  27. - name: Build wheels
  28. uses: pypa/cibuildwheel@v2.15.0
  29. env:
  30. CIBW_BUILD: "${{ matrix.python-version}}-* "
  31. CIBW_SKIP: "cp27-* cp35-* *-win32 pp* *-musllinux*"
  32. CIBW_BUILD_VERBOSITY: 3
  33. - name: Display wheels
  34. shell: bash
  35. run: |
  36. ls -lh ./wheelhouse/
  37. ls -lh ./wheelhouse/*.whl
  38. - uses: actions/upload-artifact@v2
  39. with:
  40. path: ./wheelhouse/*.whl
  41. - name: Publish to huggingface
  42. if: matrix.python-version == 'cp38'
  43. env:
  44. HF_TOKEN: ${{ secrets.HF_TOKEN }}
  45. uses: nick-fields/retry@v2
  46. with:
  47. max_attempts: 20
  48. timeout_seconds: 200
  49. shell: bash
  50. command: |
  51. git config --global user.email "csukuangfj@gmail.com"
  52. git config --global user.name "Fangjun Kuang"
  53. rm -rf huggingface
  54. export GIT_LFS_SKIP_SMUDGE=1
  55. git clone https://huggingface.co/csukuangfj/sherpa-ncnn-wheels huggingface
  56. cd huggingface
  57. git fetch
  58. git pull
  59. git merge -m "merge remote" --ff origin main
  60. cp -v ../wheelhouse/*.whl .
  61. git status
  62. git add .
  63. git commit -m "add more wheels"
  64. git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-ncnn-wheels main
  65. - name: Publish wheels to PyPI
  66. env:
  67. TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
  68. TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  69. run: |
  70. python3 -m pip install --upgrade pip
  71. python3 -m pip install wheel twine setuptools
  72. twine upload ./wheelhouse/*.whl
  73. - name: Build sdist
  74. if: matrix.python-version == 'cp38'
  75. shell: bash
  76. run: |
  77. python3 setup.py sdist
  78. ls -lh dist/*
  79. - name: Publish sdist to PyPI
  80. if: matrix.python-version == 'cp38'
  81. env:
  82. TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
  83. TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  84. run: |
  85. python3 -m pip install --upgrade pip
  86. python3 -m pip install wheel twine setuptools
  87. twine upload dist/sherpa*.tar.gz