Skip to content

Python Package Build and Release (nightly) #125

Python Package Build and Release (nightly)

Python Package Build and Release (nightly) #125

# 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: Get and set nightly date
id: date
run: |
DATE=$(date +'%Y%m%d')
echo "NIGHTLY_RELEASE_DATE=${DATE}" >> $GITHUB_ENV
echo "date=${DATE}" >> $GITHUB_OUTPUT
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install python-build and twine
run: |
python -m pip install --upgrade pip
python -m pip install build twine wheel
python -m pip list
- name: Build the wheel
run: |
python setup.py bdist_wheel
- name: Verify the distribution
run: twine check --strict dist/*
- name: List the contents of the wheel
run: python -m zipfile --list dist/*.whl
- name: Upload to PyPI
run: twine upload dist/* --non-interactive -p ${{ secrets.PYPI_UPLOAD_TOKEN }}
run-pip-install-and-import-test:
needs: build-and-release-nightly
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
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"