Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move release pipeline to a separate file | chore(release) #619

Merged
merged 9 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
107 changes: 107 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
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

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 dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-dev.txt
- uses: actions/download-artifact@v3
with:
name: wheels
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
environment: PyPI Dev
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different environments are used here

# 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: wheels
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: wheels
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 }}
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,6 +16,7 @@ beartype

# Testing
expecttest
hypothesis
parameterized
pytest-cov
pytest-randomly
Expand All @@ -28,4 +28,4 @@ torch>=1.13

# Lint
lintrunner
lintrunner_adapters>=0.6.1
lintrunner_adapters>=0.7.0