Build and Release (nightly) #208
This file contains 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
# Helpful YAML parser to clarify YAML syntax: | |
# https://yaml-online-parser.appspot.com/ | |
name: Build and Release (nightly) | |
on: | |
schedule: | |
# 10 am UTC is 3am or 4am PT depending on daylight savings. | |
- cron: "0 10 * * *" | |
workflow_dispatch: {} | |
jobs: | |
run-unittests-python: | |
if: | | |
github.event_name == 'workflow_dispatch' || | |
(github.event_name == 'schedule' && github.repository == 'google-ai-edge/ai-edge-torch') | |
name: Unit Tests Python | |
uses: ./.github/workflows/unittests_python.yml | |
with: | |
trigger-sha: ${{ github.sha }} | |
build-and-release-nightly: | |
needs: run-unittests-python | |
runs-on: ubuntu-latest | |
name: Build and Release ai-edge-torch-nightly | |
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 ai_edge_torch 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.10", "3.11"] | |
name: Test Install and Import ai-edge-torch | |
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-torch-nightly | |
run: | | |
python -m pip install ai-edge-torch-nightly | |
- name: Import ai-edge-torch | |
run: | | |
python -c "import ai_edge_torch" |