From 7811156ef476bdea9cc5bf38b04703908552b4eb Mon Sep 17 00:00:00 2001 From: jwithers Date: Wed, 15 Nov 2023 13:12:36 -0800 Subject: [PATCH] PyPI whl build and upload to PyPI test server nightly job (#2317) This script builds the python 3.10 and 3.11 wheels using python/tflite_micro/pypi_build.sh and then uploads to the test PyPI server with python/tflite_micro/pypi_upload.sh. It is scheduled to run at 1300 UTC each day (0600 or 0700 PST). The runs require approximately 11 minutes. This job can also be run manually by going to Actions > PyPI Build. There is an option to run only the whl build without upload for troubleshooting. It also should be relatively obvious how to add a release build option if the live server key was added to repo secrets and the script env block and another optional run block added with the -p switch added to a copy of the upload script line. I have tested the build block, but can't test the upload section since I don't have access to the PYPI_API_KEY secret. BUG=request from rj --- .github/workflows/pypi_build.yml | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/pypi_build.yml diff --git a/.github/workflows/pypi_build.yml b/.github/workflows/pypi_build.yml new file mode 100644 index 00000000000..58052fefeab --- /dev/null +++ b/.github/workflows/pypi_build.yml @@ -0,0 +1,50 @@ +# 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/ +# + +name: PyPI Build + +on: + schedule: + # 1pm UTC is 6am or 7am PT depending on daylight savings. + - cron: '0 13 * * *' + + workflow_dispatch: + inputs: + upload-type: + description: 'Upload type' + required: true + default: 'pypi' + type: choice + options: + - 'pypi' + - 'no upload' +env: + TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }} + +jobs: + pypi-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.TFLM_BOT_REPO_TOKEN }} + - name: Build Wheel 3.10 + run: | + python/tflite_micro/pypi_build.sh cp310 + - name: Build Wheel 3.11 + run: | + python/tflite_micro/pypi_build.sh cp311 + - name: Check Directory Output + run: | + ls -l bazel-pypi-out + - name: upload to pypi + if: | + github.event.inputs.upload-type == 'pypi' || + github.event_name == 'schedule' + run: | + python/tflite_micro/pypi_upload.sh \ + bazel-pypi-out/tflite_micro-*.whl \ No newline at end of file