Skip to content

[Task] : Use mw_main_pad branch. #77

[Task] : Use mw_main_pad branch.

[Task] : Use mw_main_pad branch. #77

name: Build Release and Publish maca wheels CI
on:
workflow_dispatch:
push:
# Ensure that only a single job or workflow using the same
# concurrency group will run at a time. This would cancel
# any in-progress jobs in the same github workflow and github
# ref (e.g. refs/heads/main or refs/pull/<pr_number>/merge).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_macos:
name: MacOS Build
runs-on: macos-15
env:
CACHE_DIR: ${{ github.workspace }}/.container-cache
defaults:
run:
shell: bash
# Elevates permissions for `GITHUB_TOKEN`'s content scope (to allow this action to make a release)
permissions:
contents: write
# Don't run this in everyone's forks on schedule but allow to run via dispatch.
if: ${{ github.repository_owner == 'llvm' || github.event_name != 'schedule' }}
strategy:
matrix:
package: [torch-mlir]
py_version: [cp311-cp311]
python-version: ["3.11"]
torch-version: [stable]
steps:
- name: Checkout torch-mlir
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: mathworks/torch-mlir
ref: refs/heads/mw_main_pad
submodules: 'true'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup workspace
uses: ./.github/actions/setup-build
with:
cache-enabled: 'true'
torch-version: 'stable'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install python deps (torch-${{ matrix.torch-version }})
run: |
cd $GITHUB_WORKSPACE
./build_tools/ci/install_python_deps.sh ${{ matrix.torch-version }}
- name: Put current date into a variable
run: |
echo "NOW=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Enable cache
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ env.CACHE_DIR }}
key: build-test-cpp-asserts-macos-${{ matrix.torch-version }}-v2-${{ github.event.number || github.sha }}
restore-keys: |
build-test-cpp-asserts-macos-${{ matrix.torch-version }}-v2-
- name: ccache
uses: hendrikmuhs/ccache-action@53911442209d5c18de8a31615e0923161e435875 # v1.2.16
with:
key: ${{ github.job }}-${{ matrix.torch-version }}
save: ${{ needs.setup.outputs.write-caches == 1 }}
- name: Build torch-mlir
run: |
cd $GITHUB_WORKSPACE
sudo ./build_tools/python_deploy/install_macos_deps.sh
cache_dir="${{ env.CACHE_DIR }}" \
build_dir=build_stable ./build_tools/python_deploy/build_maca_ci.sh
- name: Save cache
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: ${{ !cancelled() }}
with:
path: ${{ env.CACHE_DIR }}
key: build-test-cpp-asserts-macos-${{ matrix.torch-version }}-v2-${{ github.event.number || github.sha }}
- name: Build Python wheels and smoke test
run: |
tm_package_version="$(printf '${{ env.NOW }}.${{ github.run_number }}')"
echo "tm_package_version=${tm_package_version}" >> $GITHUB_ENV
printf "TORCH_MLIR_PYTHON_PACKAGE_VERSION=%s\n" ${tm_package_version} > ./torch_mlir_package_version
CMAKE_GENERATOR=Ninja TORCH_MLIR_PYTHON_PACKAGE_VERSION=${tm_package_version} TORCH_MLIR_CMAKE_BUILD_DIR=build_stable TORCH_MLIR_CMAKE_ALREADY_BUILT=1 python setup.py bdist_wheel
- name: Upload python wheels
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
if-no-files-found: error
name: snapshot-${{ matrix.package }}-${{ matrix.py_version }}-${{ env.tm_package_version }}
path: dist
- name: Release python wheels
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v.1.15.0
with:
artifacts: dist/*.whl
token: "${{ secrets.GITHUB_TOKEN }}"
tag: "dev-wheels"
name: "dev-wheels"
body: "Automatic snapshot release of torch-mlir python wheels."
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true