Nightly-Mac-Arm64 #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Nightly-Mac-Arm64" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| is_nightly: | |
| description: 'Whether to build the nightly package (sets DEV_BUILD=1)' | |
| required: true | |
| default: true | |
| type: boolean | |
| publish_to_pypi: | |
| description: 'Publish to PyPI' | |
| required: true | |
| default: false | |
| type: boolean | |
| schedule: | |
| - cron: '0 21 * * *' | |
| timezone: 'America/Los_Angeles' | |
| jobs: | |
| build-mac-wheel: | |
| name: "Build Python Wheel ${{ matrix.python-version }}" | |
| runs-on: macos-latest | |
| env: | |
| DEV_BUILD: ${{ (github.event_name == 'schedule' || github.event.inputs.is_nightly == 'true') && '1' || '0' }} | |
| PUBLISH_TO_PYPI: ${{ (github.event_name == 'schedule' || github.event.inputs.publish_to_pypi == 'true') && 'true' || 'false' }} | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - name: Checkout code. | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Build Python Wheel | |
| run: | | |
| PYTHON_VERSION=${{ matrix.python-version }} | |
| DATE=$(TZ=America/Los_Angeles date +'%Y%m%d') | |
| bazel build --config=macos_arm64 \ | |
| --repo_env=HERMETIC_PYTHON_VERSION=${PYTHON_VERSION} \ | |
| --@rules_python//python/config_settings:python_version=${PYTHON_VERSION} \ | |
| --define=DEV_BUILD=${{ env.DEV_BUILD }} \ | |
| --define=DEV_VERSION=${DATE} \ | |
| -c opt //python/litert_lm:wheel | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Test Python Wheel | |
| run: | | |
| PYTHON_VERSION=${{ matrix.python-version }} | |
| uv venv --python=${PYTHON_VERSION} | |
| # Install the built wheel | |
| WHEEL_PATH=$(find bazel-bin/python/litert_lm -name "*.whl" | head -n 1) | |
| uv pip install $WHEEL_PATH | |
| # Run the verification script | |
| uv run python python/litert_lm/examples/simple_main.py | |
| - name: Publish to PyPI | |
| if: env.PUBLISH_TO_PYPI == 'true' | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_UPLOAD_TOKEN }} | |
| run: | | |
| WHEEL_PATH=$(find bazel-bin/python/litert_lm -name "*.whl" | head -n 1) | |
| uv publish $WHEEL_PATH |