-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
5eafe2a
commit ba0ff2e
Showing
4 changed files
with
113 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
# 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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
"beartype", | ||
"types-PyYAML", | ||
"expecttest", | ||
"hypothesis", | ||
"packaging", | ||
"parameterized", | ||
"pytest-cov", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters