diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c6fbb62da..a267715f1 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 000000000..fb2d43760 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 }} diff --git a/noxfile.py b/noxfile.py index 2563a3a8f..1e6b26bc1 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 dc33a0efb..5f5414192 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,8 +1,7 @@ -numpy -onnx-weekly setuptools>=61.0.0 ---pre -f https://onnxruntimepackages.z14.web.core.windows.net/onnxruntime-function-experiment.html -ort-function-experiment-nightly +numpy +onnx-weekly==1.14.0.dev20230403 +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