|
| 1 | +name: Build Release and Publish |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + # Runs at 11:00 AM UTC, which is 3:00 AM PST (UTC-8) |
| 7 | + - cron: '0 11 * * *' |
| 8 | + |
| 9 | +# Ensure that only a single job or workflow using the same |
| 10 | +# concurrency group will run at a time. This would cancel |
| 11 | +# any in-progress jobs in the same github workflow and github |
| 12 | +# ref (e.g. refs/heads/main or refs/pull/<pr_number>/merge). |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + build_linux: |
| 19 | + name: Linux x86_64 Build |
| 20 | + runs-on: ubuntu-latest |
| 21 | + # Elevates permissions for `GITHUB_TOKEN`'s content scope (to allow this action to make a release) |
| 22 | + permissions: |
| 23 | + contents: write |
| 24 | + # Don't run this in everyone's forks. |
| 25 | + if: github.repository == 'llvm/torch-mlir-release' |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + package: [torch-mlir] |
| 29 | + py_version: [cp310-cp310, cp311-cp311] |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout torch-mlir |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + repository: llvm/torch-mlir |
| 36 | + ref: refs/heads/main |
| 37 | + submodules: 'true' |
| 38 | + |
| 39 | + - name: Setup workspace |
| 40 | + uses: ./.github/actions/setup-build |
| 41 | + |
| 42 | + - name: Build Python wheels and smoke test |
| 43 | + run: | |
| 44 | + cd $GITHUB_WORKSPACE |
| 45 | + tm_package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')" |
| 46 | + echo "tm_package_version=${tm_package_version}" >> $GITHUB_ENV |
| 47 | + printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" ${tm_package_version} > ./torch_mlir_package_version |
| 48 | + TM_PYTHON_VERSIONS=${{ matrix.py_version }} TM_PACKAGES=${{ matrix.package }} ./build_tools/python_deploy/build_linux_packages.sh |
| 49 | +
|
| 50 | + - name: Make assets available in dist |
| 51 | + run: | |
| 52 | + mkdir dist |
| 53 | + cp build_tools/python_deploy/wheelhouse/torch*.whl dist/ |
| 54 | +
|
| 55 | + - name: Upload python wheels |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + if-no-files-found: error |
| 59 | + name: snapshot-${{ matrix.package }}-${{ matrix.py_version }}-${{ env.tm_package_version }} |
| 60 | + path: dist |
| 61 | + |
| 62 | + - name: Release python wheels |
| 63 | + |
| 64 | + with: |
| 65 | + artifacts: dist/*.whl |
| 66 | + token: "${{ secrets.GITHUB_TOKEN }}" |
| 67 | + tag: "dev-wheels" |
| 68 | + name: "dev-wheels" |
| 69 | + body: "Automatic snapshot release of torch-mlir python wheels." |
| 70 | + removeArtifacts: false |
| 71 | + allowUpdates: true |
| 72 | + replacesArtifacts: true |
| 73 | + makeLatest: true |
0 commit comments