publish.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # This workflow will upload a Python Package to Release asset
  2. # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions
  3. name: Create Release
  4. on:
  5. push:
  6. tags:
  7. - v*
  8. # Needed to create release and upload assets
  9. permissions:
  10. contents: write
  11. jobs:
  12. release:
  13. # Retrieve tag and create release
  14. name: Create Release
  15. runs-on: ubuntu-latest
  16. outputs:
  17. upload_url: ${{ steps.create_release.outputs.upload_url }}
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@v3
  21. - name: Extract branch info
  22. shell: bash
  23. run: |
  24. echo "release_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
  25. - name: Create Release
  26. id: create_release
  27. uses: "actions/github-script@v6"
  28. env:
  29. RELEASE_TAG: ${{ env.release_tag }}
  30. with:
  31. github-token: "${{ secrets.GITHUB_TOKEN }}"
  32. script: |
  33. const script = require('.github/workflows/scripts/create_release.js')
  34. await script(github, context, core)
  35. wheel:
  36. name: Build Wheel
  37. runs-on: ${{ matrix.os }}
  38. needs: release
  39. strategy:
  40. fail-fast: false
  41. matrix:
  42. os: ['ubuntu-22.04']
  43. python-version: ['3.12']
  44. pytorch-version: ['2.4.0'] # Must be the most recent version that meets requirements-cuda.txt.
  45. cuda-version: ['12.4']
  46. steps:
  47. - name: Checkout
  48. uses: actions/checkout@v3
  49. - name: Setup ccache
  50. uses: hendrikmuhs/ccache-action@v1.2
  51. with:
  52. create-symlink: true
  53. key: ${{ github.job }}-${{ matrix.python-version }}-${{ matrix.cuda-version }}
  54. - name: Set up Linux Env
  55. if: ${{ runner.os == 'Linux' }}
  56. run: |
  57. bash -x .github/workflows/scripts/env.sh
  58. - name: Set up Python
  59. uses: actions/setup-python@v4
  60. with:
  61. python-version: ${{ matrix.python-version }}
  62. - name: Install CUDA ${{ matrix.cuda-version }}
  63. run: |
  64. bash -x .github/workflows/scripts/cuda-install.sh ${{ matrix.cuda-version }} ${{ matrix.os }}
  65. - name: Install PyTorch ${{ matrix.pytorch-version }} with CUDA ${{ matrix.cuda-version }}
  66. run: |
  67. bash -x .github/workflows/scripts/pytorch-install.sh ${{ matrix.python-version }} ${{ matrix.pytorch-version }} ${{ matrix.cuda-version }}
  68. - name: Build wheel
  69. shell: bash
  70. env:
  71. CMAKE_BUILD_TYPE: Release # do not compile with debug symbol to reduce wheel size
  72. run: |
  73. bash -x .github/workflows/scripts/build.sh ${{ matrix.python-version }} ${{ matrix.cuda-version }}
  74. wheel_name=$(ls dist/*whl | xargs -n 1 basename)
  75. asset_name=${wheel_name//"linux"/"manylinux1"}
  76. echo "wheel_name=${wheel_name}" >> $GITHUB_ENV
  77. echo "asset_name=${asset_name}" >> $GITHUB_ENV
  78. - name: Upload Release Asset
  79. uses: actions/upload-release-asset@v1
  80. env:
  81. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  82. with:
  83. upload_url: ${{ needs.release.outputs.upload_url }}
  84. asset_path: ./dist/${{ env.wheel_name }}
  85. asset_name: ${{ env.asset_name }}
  86. asset_content_type: application/*