From 3d191bef1fe6ea9dc4337863af258cdfed455cce Mon Sep 17 00:00:00 2001 From: Google AI Edge Date: Tue, 21 May 2024 12:51:34 -0700 Subject: [PATCH] No public description PiperOrigin-RevId: 635898443 --- .github/workflows/build_release.yml | 54 +++++++++++++++++++++++++ .github/workflows/nightly_unittests.yml | 17 ++++++++ .github/workflows/unittests_python.yml | 46 +++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 .github/workflows/build_release.yml create mode 100644 .github/workflows/nightly_unittests.yml create mode 100644 .github/workflows/unittests_python.yml diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml new file mode 100644 index 0000000..921725f --- /dev/null +++ b/.github/workflows/build_release.yml @@ -0,0 +1,54 @@ +# 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 +# 2. Upload Release Asset + +name: Python Package Build and Release + +on: + workflow_dispatch: # Allow manual triggers + schedule: + - cron: "0 0 * * *" # 12am UTC (5pm PST) + +jobs: + build_python_package: + name: Build Python Wheel + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - 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: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y%m%d')" + + - name: Upload Release Asset + uses: softprops/action-gh-release@v0.1.15 + with: + files: dist/*.whl + prerelease: true + tag_name: nightly-tag-${{ steps.date.outputs.date }} diff --git a/.github/workflows/nightly_unittests.yml b/.github/workflows/nightly_unittests.yml new file mode 100644 index 0000000..94007b8 --- /dev/null +++ b/.github/workflows/nightly_unittests.yml @@ -0,0 +1,17 @@ +# Helpful YAML parser to clarify YAML syntax: +# https://yaml-online-parser.appspot.com/ + +name: Unit Tests (nightly) + +on: + schedule: + - cron: "0 10 * * *" # 10am UTC (3am PST) + + workflow_dispatch: # Allow manual triggers + +jobs: + run-unittests-python: + name: Unit Tests Python + uses: ./.github/workflows/unittests_python.yml + with: + trigger-sha: ${{ github.sha }} diff --git a/.github/workflows/unittests_python.yml b/.github/workflows/unittests_python.yml new file mode 100644 index 0000000..e52cff4 --- /dev/null +++ b/.github/workflows/unittests_python.yml @@ -0,0 +1,46 @@ +# 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 nightly or when triggered from PR comment + +name: Python Unit Tests + +on: + workflow_call: + inputs: + trigger-sha: + required: true + type: string + +jobs: + test: + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.trigger-sha }} + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: "**/*requirements.txt" + + - run: python -m pip install --upgrade pip setuptools + + - name: Install dependencies + run: | + python -m pip install -r requirements.txt + + - name: Run Tests + run: | + python -m unittest discover --pattern *_test.py + env: + STABLEHLO_BYTECODE_FROM_PRETTYPRINT: 1 + CI: "true"