pip.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. name: Pip
  2. on:
  3. workflow_dispatch:
  4. pull_request:
  5. push:
  6. branches:
  7. - master
  8. - stable
  9. - v*
  10. release:
  11. types:
  12. - published
  13. jobs:
  14. # This builds the sdists and wheels and makes sure the files are exactly as
  15. # expected. Using Windows and Python 2.7, since that is often the most
  16. # challenging matrix element.
  17. test-packaging:
  18. name: 🐍 2.7 • 📦 tests • windows-latest
  19. runs-on: windows-latest
  20. steps:
  21. - uses: actions/checkout@v2
  22. - name: Setup 🐍 2.7
  23. uses: actions/setup-python@v2
  24. with:
  25. python-version: 2.7
  26. - name: Prepare env
  27. run: python -m pip install -r tests/requirements.txt --prefer-binary
  28. - name: Python Packaging tests
  29. run: pytest tests/extra_python_package/
  30. # This runs the packaging tests and also builds and saves the packages as
  31. # artifacts.
  32. packaging:
  33. name: 🐍 3.8 • 📦 & 📦 tests • ubuntu-latest
  34. runs-on: ubuntu-latest
  35. steps:
  36. - uses: actions/checkout@v2
  37. - name: Setup 🐍 3.8
  38. uses: actions/setup-python@v2
  39. with:
  40. python-version: 3.8
  41. - name: Prepare env
  42. run: python -m pip install -r tests/requirements.txt build twine --prefer-binary
  43. - name: Python Packaging tests
  44. run: pytest tests/extra_python_package/
  45. - name: Build SDist and wheels
  46. run: |
  47. python -m build
  48. PYBIND11_GLOBAL_SDIST=1 python -m build
  49. - name: Check metadata
  50. run: twine check dist/*
  51. - name: Save standard package
  52. uses: actions/upload-artifact@v2
  53. with:
  54. name: standard
  55. path: dist/pybind11-*
  56. - name: Save global package
  57. uses: actions/upload-artifact@v2
  58. with:
  59. name: global
  60. path: dist/pybind11_global-*
  61. # When a GitHub release is made, upload the artifacts to PyPI
  62. upload:
  63. name: Upload to PyPI
  64. runs-on: ubuntu-latest
  65. if: github.event_name == 'release' && github.event.action == 'published'
  66. needs: [packaging]
  67. steps:
  68. - uses: actions/setup-python@v2
  69. # Downloads all to directories matching the artifact names
  70. - uses: actions/download-artifact@v2
  71. - name: Publish standard package
  72. uses: pypa/gh-action-pypi-publish@v1.4.2
  73. with:
  74. password: ${{ secrets.pypi_password }}
  75. packages_dir: standard/
  76. - name: Publish global package
  77. uses: pypa/gh-action-pypi-publish@v1.4.2
  78. with:
  79. password: ${{ secrets.pypi_password_global }}
  80. packages_dir: global/