Python Package Build and Release (nightly) #665
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
| # YAML schema for GitHub Actions: | |
| # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions | |
| # | |
| # Helpful YAML parser to clarify YAML syntax: | |
| # https://yaml-online-parser.appspot.com/ | |
| # | |
| # This workflow will run at the end of every day to | |
| # 1. Build Python Wheel Nightly Version | |
| # 2. Upload to PyPI | |
| name: Python Package Build and Release (nightly) | |
| on: | |
| workflow_dispatch: # Allow manual triggers | |
| schedule: | |
| - cron: "0 0 * * *" # 12am UTC (5pm PST) | |
| jobs: | |
| build-and-release-nightly: | |
| name: Build and Release Python Wheel Nightly | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Update Metadata for Nightly | |
| run: | | |
| sed -i 's/name = "ai-edge-quantizer"/name = "ai-edge-quantizer-nightly"/' pyproject.toml | |
| BASE_VERSION=$(cat VERSION | xargs) | |
| DATE=$(date +'%Y%m%d') | |
| echo "${BASE_VERSION}.dev${DATE}" > VERSION | |
| echo "Building $(cat PACKAGE_NAME) version $(cat VERSION)" | |
| - name: Build Nightly Package | |
| run: | | |
| uv build | |
| - name: Publish to PyPI | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_UPLOAD_TOKEN }} | |
| run: uv publish | |
| run-pip-install-and-import-test: | |
| needs: build-and-release-nightly | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| name: Test Install and Import ai-edge-quantizer-nightly | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: | | |
| python -m pip cache purge | |
| python -m pip install --upgrade pip | |
| - name: Install ai-edge-quantizer-nightly | |
| run: | | |
| python -m pip install ai-edge-quantizer-nightly | |
| - name: Import ai-edge-quantizer | |
| run: | | |
| python -c "import ai_edge_quantizer" |