Skip to content

Commit d4ccfa6

Browse files
committed
Add pytorch-version-override to the build_wheels_*.yml workflows
This lets repos override the torch pip version to install before building the wheel.
1 parent 4522942 commit d4ccfa6

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

.github/workflows/test_infra_build_wheels_linux.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
description: "Build matrix to utilize"
2424
default: ""
2525
type: string
26+
pytorch-version-override:
27+
description: "Manual override of the pytorch version to install"
28+
default: ""
29+
type: string
2630
pre-script:
2731
description: "Pre script to run prior to build"
2832
default: ""
@@ -136,11 +140,18 @@ jobs:
136140
set -e
137141
- uses: pytorch/test-infra/.github/actions/set-channel@release/2.3
138142
- name: Set PYTORCH_VERSION
139-
if: ${{ env.CHANNEL == 'test' }}
143+
if: ${{ inputs.pytorch-version-override != '' || env.CHANNEL == 'test' }}
140144
run: |
141-
# When building RC, set the version to be the current candidate version,
142-
# otherwise, leave it alone so nightly will pick up the latest
143-
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
145+
if [[ ! -z "${{ inputs.pytorch-version-override }}" ]]; then
146+
# If there is an override, use it instead of the version associated
147+
# with the channel.
148+
echo "PYTORCH_VERSION=${{ inputs.pytorch-version-override }}" >> "${GITHUB_ENV}"
149+
else
150+
# When building RC (test channel), set the version to be the current
151+
# candidate version, otherwise, leave it alone so nightly will pick
152+
# up the latest
153+
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
154+
fi
144155
- uses: pytorch/test-infra/.github/actions/setup-binary-builds@release/2.3
145156
env:
146157
PLATFORM: ${{ inputs.architecture == 'aarch64' && 'linux-aarch64' || ''}}

.github/workflows/test_infra_build_wheels_macos.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
description: "Build matrix to utilize"
2424
default: ""
2525
type: string
26+
pytorch-version-override:
27+
description: "Manual override of the pytorch version to install"
28+
default: ""
29+
type: string
2630
pre-script:
2731
description: "Pre script to run prior to build"
2832
default: ""
@@ -101,11 +105,18 @@ jobs:
101105
path: test-infra
102106
- uses: pytorch/test-infra/.github/actions/set-channel@release/2.3
103107
- name: Set PYTORCH_VERSION
104-
if: ${{ env.CHANNEL == 'test' }}
108+
if: ${{ inputs.pytorch-version-override != '' || env.CHANNEL == 'test' }}
105109
run: |
106-
# When building RC, set the version to be the current candidate version,
107-
# otherwise, leave it alone so nightly will pick up the latest
108-
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
110+
if [[ ! -z "${{ inputs.pytorch-version-override }}" ]]; then
111+
# If there is an override, use it instead of the version associated
112+
# with the channel.
113+
echo "PYTORCH_VERSION=${{ inputs.pytorch-version-override }}" >> "${GITHUB_ENV}"
114+
else
115+
# When building RC (test channel), set the version to be the current
116+
# candidate version, otherwise, leave it alone so nightly will pick
117+
# up the latest
118+
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
119+
fi
109120
- uses: pytorch/test-infra/.github/actions/setup-binary-builds@release/2.3
110121
with:
111122
repository: ${{ inputs.repository }}

0 commit comments

Comments
 (0)