Build and Release (nightly) #312
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
| # 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/litert-torch') | |
| name: Unit Tests Python | |
| uses: ./.github/workflows/unittests_python.yml | |
| with: | |
| trigger-sha: ${{ github.sha }} | |
| # TODO(cnchan): Re-enable once the tf-nightly pywrap issue is fixed. | |
| run-on-macos: false | |
| build-and-release-nightly: | |
| needs: run-unittests-python | |
| runs-on: ubuntu-latest | |
| name: Build and Release litert-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 litert_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", "3.12", "3.13"] | |
| name: Test Install and Import litert-torch | |
| runs-on: | |
| labels: Linux_runner_8_core | |
| 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 litert-torch-nightly | |
| run: | | |
| python -m pip install litert-torch-nightly | |
| - name: Import litert-torch | |
| run: | | |
| python -c "import litert_torch" |