deps(workflows): bump pypa/cibuildwheel from 2.14 to 2.15 #758
Workflow file for this run
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
name: Build | |
on: | |
push: | |
branches: | |
- main # allow to trigger the workflow with tag push event | |
pull_request: | |
paths: | |
- setup.py | |
- setup.cfg | |
- pyproject.toml | |
- MANIFEST.in | |
- CMakeLists.txt | |
- include/** | |
- src/** | |
- torchopt/version.py | |
- .github/workflows/build.yml | |
release: | |
types: | |
- published | |
# Allow to trigger the workflow manually | |
workflow_dispatch: | |
inputs: | |
task: | |
description: "Task type" | |
type: choice | |
options: | |
- build-only | |
- build-and-publish | |
required: true | |
permissions: | |
contents: read | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
env: | |
CUDA_VERSION: "11.7" | |
TEST_TORCH_SPECS: "cpu cu116" | |
jobs: | |
build: | |
name: Build sdist and pure-Python wheel | |
runs-on: ubuntu-latest | |
if: github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')) | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8 - 3.11" # sync with requires-python in pyproject.toml | |
update-environment: true | |
- name: Set __release__ | |
if: | | |
startsWith(github.ref, 'refs/tags/') || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'build-and-publish') | |
run: | | |
python .github/workflows/set_release.py | |
- name: Print version | |
run: python setup.py --version | |
- name: Install dependencies | |
run: python -m pip install --upgrade pip setuptools wheel build | |
- name: Build sdist and pure-Python wheel | |
run: python -m build | |
env: | |
TORCHOPT_NO_EXTENSIONS: "true" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist/* | |
if-no-files-found: error | |
- name: Install dependencies | |
run: | | |
python -m pip install -r tests/requirements.txt | |
- name: Install TorchOpt | |
run: | | |
python -m pip install -vvv dist/*.whl | |
- name: Test with pytest | |
run: | | |
make pytest | |
build-wheels-py38: | |
name: Build wheels for Python ${{ matrix.python-version }} on ubuntu-latest | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')) | |
strategy: | |
matrix: | |
python-version: ["3.8"] # sync with requires-python in pyproject.toml | |
fail-fast: false | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
update-environment: true | |
- name: Set __release__ | |
if: | | |
startsWith(github.ref, 'refs/tags/') || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'build-and-publish') | |
run: python .github/workflows/set_release.py | |
- name: Print version | |
run: python setup.py --version | |
- name: Set CIBW_BUILD | |
run: python .github/workflows/set_cibw_build.py | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ env.CIBW_BUILD }} | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
config-file: "{package}/pyproject.toml" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels-py38 | |
path: wheelhouse/*.whl | |
if-no-files-found: error | |
build-wheels: | |
name: Build wheels for Python ${{ matrix.python-version }} on ubuntu-latest | |
runs-on: ubuntu-latest | |
needs: [build, build-wheels-py38] | |
if: github.repository == 'metaopt/torchopt' && (github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')) | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] # sync with requires-python in pyproject.toml | |
fail-fast: false | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
update-environment: true | |
- name: Set __release__ | |
if: | | |
startsWith(github.ref, 'refs/tags/') || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'build-and-publish') | |
run: python .github/workflows/set_release.py | |
- name: Print version | |
run: python setup.py --version | |
- name: Set CIBW_BUILD | |
run: python .github/workflows/set_cibw_build.py | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: ${{ env.CIBW_BUILD }} | |
with: | |
package-dir: . | |
output-dir: wheelhouse | |
config-file: "{package}/pyproject.toml" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: wheelhouse/*.whl | |
if-no-files-found: error | |
publish: | |
runs-on: ubuntu-latest | |
needs: [build, build-wheels-py38, build-wheels] | |
if: | | |
github.repository == 'metaopt/torchopt' && github.event_name != 'pull_request' && | |
(github.event_name != 'workflow_dispatch' || github.event.inputs.task == 'build-and-publish') && | |
(github.event_name != 'push' || startsWith(github.ref, 'refs/tags/')) | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
python-version: "3.8 - 3.11" # sync with requires-python in pyproject.toml | |
update-environment: true | |
- name: Set __release__ | |
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
run: | | |
python .github/workflows/set_release.py | |
- name: Print version | |
run: python setup.py --version | |
- name: Check consistency between the package version and release tag | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
PACKAGE_VER="v$(python setup.py --version)" | |
RELEASE_TAG="${GITHUB_REF#refs/*/}" | |
if [[ "${PACKAGE_VER}" != "${RELEASE_TAG}" ]]; then | |
echo "package ver. (${PACKAGE_VER}) != release tag. (${RELEASE_TAG})" | |
exit 1 | |
fi | |
- name: Download built sdist | |
uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: build | |
path: dist | |
- name: Download built wheels | |
uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: wheels-py38 | |
path: dist | |
- name: Download built wheels | |
uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: wheels | |
path: dist | |
- name: List distributions | |
run: ls -lh dist/* | |
- name: Publish to TestPyPI | |
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TESTPYPI_UPLOAD_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
verbose: true | |
print_hash: true | |
skip_existing: true | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_UPLOAD_TOKEN }} | |
verbose: true | |
print_hash: true | |
skip_existing: true |