From a9c61e9800205576cdf36316cd7c7d14de2cc9a0 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 11 Apr 2023 16:25:30 +0000 Subject: [PATCH 1/8] Move release pipeline to a separate file | chore(release) --- .github/workflows/main.yaml | 52 --------------------- .github/workflows/release.yaml | 82 ++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c6fbb62da4..a267715f19 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -97,55 +97,3 @@ jobs: run: pip install . - name: Build documentation run: python -m sphinx docs dist/html - - release: - needs: [test] - if: github.event_name != 'pull_request' || startsWith( github.base_ref, 'rel-') || contains( github.event.pull_request.labels.*.name, 'run release CIs') - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.10'] - steps: - - name: Checkout ONNX Script - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install Python build dependencies - run: | - python -m pip install --upgrade pip build wheel - - name: Build ONNX Script wheel dev version - run: | - python -m build - if: (!startsWith(github.ref, 'refs/tags/v')) - - name: Build ONNX Script wheel release version - run: | - python -m build - if: startsWith(github.ref, 'refs/tags/v') - env: - ONNX_SCRIPT_RELEASE: 1 - - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist - - name: Install ONNX Script wheel - run: | - python -m pip install dist/*.whl - - publish: - needs: [release] - runs-on: ubuntu-latest - environment: production - # Publish only when it is a scheduled run (weekly dev builds) or a tag push with version number - if: (github.event_name == 'schedule') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) - steps: - - uses: actions/download-artifact@v3 - with: - name: dist - path: dist - # TODO: Check the tag name matches the VERSION file - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000000..e005ead9f5 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,82 @@ +name: Release + +on: + schedule: + # Run weekly on Mondays and Wednesdays 00:00 + - cron: '00 00 * * MON,WED' + push: + branches: [main, rel-*] + pull_request: + branches: [main, rel-*] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + release: + if: github.event_name != 'pull_request' || startsWith( github.base_ref, 'rel-') || contains( github.event.pull_request.labels.*.name, 'run release CIs') + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10'] + steps: + - name: Checkout ONNX Script + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Python build dependencies + run: | + python -m pip install --upgrade pip build wheel + - name: Build ONNX Script wheel dev version + run: | + python -m build + if: (!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))) + - name: Build ONNX Script wheel release version + run: | + python -m build + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + env: + ONNX_SCRIPT_RELEASE: 1 + - uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + - name: Install ONNX Script wheel + run: | + python -m pip install dist/*.whl + + publish-dev: + needs: [release] + runs-on: ubuntu-latest + environment: PyPI Dev + # Publish only when it is a scheduled run (dev builds) + if: github.event_name == 'schedule' && !startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v3 + with: + name: dist + path: dist + # TODO: Check the version number is a dev version + - name: Publish dev version to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + + publish-release: + needs: [release] + runs-on: ubuntu-latest + environment: PyPI + # Publish only when it is a tag push with version number + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v3 + with: + name: dist + path: dist + # TODO: Check the tag name matches the VERSION file + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} From d71391d7a1d1c43a96ba7e2c59dc3cd190e89b97 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 11 Apr 2023 09:29:34 -0700 Subject: [PATCH 2/8] Update release.yaml --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e005ead9f5..50930147e3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,7 +14,7 @@ on: jobs: release: - if: github.event_name != 'pull_request' || startsWith( github.base_ref, 'rel-') || contains( github.event.pull_request.labels.*.name, 'run release CIs') + if: github.event_name != 'pull_request' || startsWith(github.base_ref, 'rel-') || contains(github.event.pull_request.labels.*.name, 'run release CIs') runs-on: ubuntu-latest strategy: matrix: From 9a8c433837c10cb0dbcc4da39d428f15f4d6fda6 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 11 Apr 2023 10:33:24 -0700 Subject: [PATCH 3/8] Update release.yaml --- .github/workflows/release.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 50930147e3..1258209e6b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -47,6 +47,31 @@ jobs: run: | python -m pip install dist/*.whl + test-wheel: + needs: [release] + runs-on: ubuntu-latest + steps: + - name: Checkout ONNX Script + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Python build dependencies + run: | + python -m pip install --upgrade pip wheel + python -m pip install -r requirements-dev.txt + - uses: actions/download-artifact@v3 + with: + name: dist + path: dist + - name: Install wheel + run: | + python -m pip install dist/*.whl + - name: Run tests + run: | + python -m pytest -v -n auto + publish-dev: needs: [release] runs-on: ubuntu-latest From 9f6fc9469d3fe700d52dd11b2477d3ef1d169d0c Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 11 Apr 2023 10:38:30 -0700 Subject: [PATCH 4/8] Update release.yaml --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1258209e6b..8dae9551af 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -63,7 +63,7 @@ jobs: python -m pip install -r requirements-dev.txt - uses: actions/download-artifact@v3 with: - name: dist + name: wheels path: dist - name: Install wheel run: | @@ -81,7 +81,7 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: dist + name: wheels path: dist # TODO: Check the version number is a dev version - name: Publish dev version to PyPI @@ -98,7 +98,7 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: dist + name: wheels path: dist # TODO: Check the tag name matches the VERSION file - name: Publish to PyPI From e72df7a1e90277a9626e0a69f89a91201328d686 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 11 Apr 2023 10:55:43 -0700 Subject: [PATCH 5/8] Update requirements-dev.txt --- requirements-dev.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index dc33a0efb4..c345a209c9 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,8 +1,7 @@ +setuptools>=61.0.0 numpy onnx-weekly -setuptools>=61.0.0 ---pre -f https://onnxruntimepackages.z14.web.core.windows.net/onnxruntime-function-experiment.html -ort-function-experiment-nightly +onnxruntime typing_extensions # Docs site @@ -17,6 +16,7 @@ beartype # Testing expecttest +hypothesis parameterized pytest-cov pytest-randomly @@ -28,4 +28,4 @@ torch>=1.13 # Lint lintrunner -lintrunner_adapters>=0.6.1 +lintrunner_adapters>=0.7.0 From 167334e1c4c5a724b0940ec7d0469c5ceaa166ad Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 11 Apr 2023 10:56:10 -0700 Subject: [PATCH 6/8] Update release.yaml --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8dae9551af..838e6303b5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,7 +26,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install Python build dependencies + - name: Install Python dependencies run: | python -m pip install --upgrade pip build wheel - name: Build ONNX Script wheel dev version From 1c47ff76d8af39e2569a81154f27cf5d97b1cb4b Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 11 Apr 2023 10:56:37 -0700 Subject: [PATCH 7/8] Update release.yaml --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 838e6303b5..fb2d437603 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,7 +26,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install Python dependencies + - name: Install Python build dependencies run: | python -m pip install --upgrade pip build wheel - name: Build ONNX Script wheel dev version @@ -57,7 +57,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install Python build dependencies + - name: Install Python dependencies run: | python -m pip install --upgrade pip wheel python -m pip install -r requirements-dev.txt From 05c37b9176ca716bd7a333a515c3d6506e6337b8 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 11 Apr 2023 18:18:17 +0000 Subject: [PATCH 8/8] Pin version --- noxfile.py | 1 + requirements-dev.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 2563a3a8f1..1e6b26bc10 100644 --- a/noxfile.py +++ b/noxfile.py @@ -16,6 +16,7 @@ "beartype", "types-PyYAML", "expecttest", + "hypothesis", "packaging", "parameterized", "pytest-cov", diff --git a/requirements-dev.txt b/requirements-dev.txt index c345a209c9..5f54141923 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ setuptools>=61.0.0 numpy -onnx-weekly +onnx-weekly==1.14.0.dev20230403 onnxruntime typing_extensions