Skip to content

Commit ba0ff2e

Browse files
authored
Move release pipeline to a separate file | chore(release) (#619)
I moved the release pipeline out because the tests are sometimes flaky but we may not want them to block the scheduled release. I separated the dev and official releases to use different environments so the official releases can be manually reviewed before uploading to pypi. Updated requirements-dev.txt
1 parent 5eafe2a commit ba0ff2e

File tree

4 files changed

+113
-57
lines changed

4 files changed

+113
-57
lines changed

.github/workflows/main.yaml

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -97,55 +97,3 @@ jobs:
9797
run: pip install .
9898
- name: Build documentation
9999
run: python -m sphinx docs dist/html
100-
101-
release:
102-
needs: [test]
103-
if: github.event_name != 'pull_request' || startsWith( github.base_ref, 'rel-') || contains( github.event.pull_request.labels.*.name, 'run release CIs')
104-
runs-on: ubuntu-latest
105-
strategy:
106-
matrix:
107-
python-version: ['3.10']
108-
steps:
109-
- name: Checkout ONNX Script
110-
uses: actions/checkout@v3
111-
- name: Set up Python ${{ matrix.python-version }}
112-
uses: actions/setup-python@v4
113-
with:
114-
python-version: ${{ matrix.python-version }}
115-
- name: Install Python build dependencies
116-
run: |
117-
python -m pip install --upgrade pip build wheel
118-
- name: Build ONNX Script wheel dev version
119-
run: |
120-
python -m build
121-
if: (!startsWith(github.ref, 'refs/tags/v'))
122-
- name: Build ONNX Script wheel release version
123-
run: |
124-
python -m build
125-
if: startsWith(github.ref, 'refs/tags/v')
126-
env:
127-
ONNX_SCRIPT_RELEASE: 1
128-
- uses: actions/upload-artifact@v3
129-
with:
130-
name: wheels
131-
path: dist
132-
- name: Install ONNX Script wheel
133-
run: |
134-
python -m pip install dist/*.whl
135-
136-
publish:
137-
needs: [release]
138-
runs-on: ubuntu-latest
139-
environment: production
140-
# Publish only when it is a scheduled run (weekly dev builds) or a tag push with version number
141-
if: (github.event_name == 'schedule') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
142-
steps:
143-
- uses: actions/download-artifact@v3
144-
with:
145-
name: dist
146-
path: dist
147-
# TODO: Check the tag name matches the VERSION file
148-
- name: Publish to PyPI
149-
uses: pypa/gh-action-pypi-publish@release/v1
150-
with:
151-
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/release.yaml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Release
2+
3+
on:
4+
schedule:
5+
# Run weekly on Mondays and Wednesdays 00:00
6+
- cron: '00 00 * * MON,WED'
7+
push:
8+
branches: [main, rel-*]
9+
pull_request:
10+
branches: [main, rel-*]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
jobs:
16+
release:
17+
if: github.event_name != 'pull_request' || startsWith(github.base_ref, 'rel-') || contains(github.event.pull_request.labels.*.name, 'run release CIs')
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: ['3.10']
22+
steps:
23+
- name: Checkout ONNX Script
24+
uses: actions/checkout@v3
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install Python build dependencies
30+
run: |
31+
python -m pip install --upgrade pip build wheel
32+
- name: Build ONNX Script wheel dev version
33+
run: |
34+
python -m build
35+
if: (!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')))
36+
- name: Build ONNX Script wheel release version
37+
run: |
38+
python -m build
39+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
40+
env:
41+
ONNX_SCRIPT_RELEASE: 1
42+
- uses: actions/upload-artifact@v3
43+
with:
44+
name: wheels
45+
path: dist
46+
- name: Install ONNX Script wheel
47+
run: |
48+
python -m pip install dist/*.whl
49+
50+
test-wheel:
51+
needs: [release]
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout ONNX Script
55+
uses: actions/checkout@v3
56+
- name: Set up Python ${{ matrix.python-version }}
57+
uses: actions/setup-python@v4
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
- name: Install Python dependencies
61+
run: |
62+
python -m pip install --upgrade pip wheel
63+
python -m pip install -r requirements-dev.txt
64+
- uses: actions/download-artifact@v3
65+
with:
66+
name: wheels
67+
path: dist
68+
- name: Install wheel
69+
run: |
70+
python -m pip install dist/*.whl
71+
- name: Run tests
72+
run: |
73+
python -m pytest -v -n auto
74+
75+
publish-dev:
76+
needs: [release]
77+
runs-on: ubuntu-latest
78+
environment: PyPI Dev
79+
# Publish only when it is a scheduled run (dev builds)
80+
if: github.event_name == 'schedule' && !startsWith(github.ref, 'refs/tags/v')
81+
steps:
82+
- uses: actions/download-artifact@v3
83+
with:
84+
name: wheels
85+
path: dist
86+
# TODO: Check the version number is a dev version
87+
- name: Publish dev version to PyPI
88+
uses: pypa/gh-action-pypi-publish@release/v1
89+
with:
90+
password: ${{ secrets.PYPI_API_TOKEN }}
91+
92+
publish-release:
93+
needs: [release]
94+
runs-on: ubuntu-latest
95+
environment: PyPI
96+
# Publish only when it is a tag push with version number
97+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
98+
steps:
99+
- uses: actions/download-artifact@v3
100+
with:
101+
name: wheels
102+
path: dist
103+
# TODO: Check the tag name matches the VERSION file
104+
- name: Publish to PyPI
105+
uses: pypa/gh-action-pypi-publish@release/v1
106+
with:
107+
password: ${{ secrets.PYPI_API_TOKEN }}

noxfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"beartype",
1717
"types-PyYAML",
1818
"expecttest",
19+
"hypothesis",
1920
"packaging",
2021
"parameterized",
2122
"pytest-cov",

requirements-dev.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
numpy
2-
onnx-weekly
31
setuptools>=61.0.0
4-
--pre -f https://onnxruntimepackages.z14.web.core.windows.net/onnxruntime-function-experiment.html
5-
ort-function-experiment-nightly
2+
numpy
3+
onnx-weekly==1.14.0.dev20230403
4+
onnxruntime
65
typing_extensions
76

87
# Docs site
@@ -17,6 +16,7 @@ beartype
1716

1817
# Testing
1918
expecttest
19+
hypothesis
2020
parameterized
2121
pytest-cov
2222
pytest-randomly
@@ -28,4 +28,4 @@ torch>=1.13
2828

2929
# Lint
3030
lintrunner
31-
lintrunner_adapters>=0.6.1
31+
lintrunner_adapters>=0.7.0

0 commit comments

Comments
 (0)