Skip to content

WindowsRelease

WindowsRelease #7

Workflow file for this run

name: WindowsRelease
on:
schedule:
# Run weekly on Monday 00:00
- cron: '00 00 * * MON'
push:
branches: [main, rel-*]
pull_request:
branches: [main, rel-*]
workflow_dispatch:
jobs:
build:
if: github.event_name != 'pull_request' || startsWith( github.base_ref, 'rel-') || contains( github.event.pull_request.labels.*.name, 'run release CIs')
runs-on: windows-latest
strategy:
matrix:
# TODO: Freeze as 3.10.5 for now and use the latest 3.10 after future numpy upgrade in ONNX;
# related issue: https://github.com/actions/setup-python/issues/481
python-version: ['3.7', '3.8', '3.9', '3.10.5', '3.11']
architecture: ['x64', 'x86']
steps:
- name: Checkout ONNX
uses: actions/checkout@v3
with:
path: ./onnx
- name: Checkout ONNX submodules
shell: bash
run: |
cd onnx
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Add msbuild to PATH
uses: microsoft/[email protected]
with:
msbuild-architecture: ${{ matrix.architecture }}
- name: Install Python dependencies
run: |
python -m pip install -q --upgrade pip
cd onnx
python -m pip install -q -r requirements-release.txt
- name: Build ONNX wheel
run: |
$arch = 'x64'
if ('${{ matrix.architecture }}' -eq 'x86') {
$arch = 'Win32'
}
. .\onnx\workflow_scripts\protobuf\build_protobuf_win.ps1 -arch $arch
cd onnx
echo "Install ONNX"
$Env:ONNX_ML=1
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DONNX_USE_LITE_PROTO=ON"
if ('${{ github.event_name }}' -eq 'schedule') {
echo "Build weekly TestPyPI package"
python setup.py bdist_wheel --weekly_build
} else {
python setup.py bdist_wheel
}
Get-ChildItem -Path dist/*.whl | foreach {python -m pip install --upgrade $_.fullname}
- name: Test the installed wheel
run: |
cd onnx
pytest
- uses: actions/upload-artifact@v1
with:
name: wheels
path: ./onnx/dist
- name: Upload wheel to TestPyPI weekly
if: (github.event_name == 'schedule') # Only triggered by weekly event
run: |
twine upload --verbose onnx/dist/*.whl --repository-url https://test.pypi.org/legacy/ -u ${{ secrets.TESTPYPI_USERNAME }} -p ${{ secrets.TESTPYPI_PASSWORD }}
- name: Verify ONNX with the latest numpy
if: ${{ always() }}
run: |
cd onnx
python -m pip uninstall -y numpy onnx && python -m pip install numpy
Get-ChildItem -Path dist/*.whl | foreach {python -m pip install --upgrade $_.fullname}
pytest
# TODO: Remove one if condition after using consistent NumPy version for all Python versions
- name: Verify ONNX with the minimum supported numpy (from requirements.txt)
if: ${{ always() }}
run: |
cd onnx
if ('${{ matrix.python-version }}' -eq '3.11') {
python -m pip uninstall -y numpy onnx && python -m pip install numpy==1.23.2
} else {
python -m pip uninstall -y numpy onnx && python -m pip install numpy==1.16.6
}
Get-ChildItem -Path dist/*.whl | foreach {python -m pip install --upgrade $_.fullname}
pytest
- name: Verify ONNX with the latest protobuf
if: ${{ always() }}
run: |
cd onnx
python -m pip uninstall -y protobuf onnx && python -m pip install protobuf
Get-ChildItem -Path dist/*.whl | foreach {python -m pip install --upgrade $_.fullname}
pytest
- name: Verify ONNX with the minimum supported protobuf (from requirements.txt)
if: ${{ always() }}
run: |
cd onnx
python -m pip uninstall -y protobuf onnx && python -m pip install protobuf==3.20.2
Get-ChildItem -Path dist/*.whl | foreach {python -m pip install --upgrade $_.fullname}
pytest
- name: Verify ONNX with ONNX Runtime PyPI package
if: matrix.python-version != '3.11'
run: |
python -m pip install -q onnxruntime
python onnx\onnx\test\test_with_ort.py