1+ name : Generates the binary build matrix
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ package-type :
7+ description : " Package type to build from (wheel, conda, libtorch)"
8+ default : " wheel"
9+ type : string
10+ os :
11+ description : " Operating system to generate for (linux, windows, macos, macos-arm64)"
12+ default : " linux"
13+ type : string
14+ channel :
15+ description : " Channel to use (nightly, test, release, all)"
16+ default : " "
17+ type : string
18+ test-infra-repository :
19+ description : " Test infra repository to use"
20+ default : " pytorch/test-infra"
21+ type : string
22+ test-infra-ref :
23+ description : " Test infra reference to use"
24+ default : " main"
25+ type : string
26+ with-cuda :
27+ description : " Build with Cuda?"
28+ default : " enable"
29+ type : string
30+ with-rocm :
31+ description : " Build with Rocm?"
32+ default : " enable"
33+ type : string
34+ with-cpu :
35+ description : " Build with CPU?"
36+ default : " enable"
37+ type : string
38+ with-xpu :
39+ description : " Build with XPU?"
40+ default : " disable"
41+ type : string
42+ use-only-dl-pytorch-org :
43+ description : " Use only download.pytorch.org when generating wheel install command?"
44+ default : " false"
45+ type : string
46+ build-python-only :
47+ description : " Generate binary build matrix for a python only package (i.e. only one python version)"
48+ default : " disable"
49+ type : string
50+ python-versions :
51+ description : " A JSON-encoded list of python versions to build. An empty list means building all supported versions"
52+ default : " []"
53+ type : string
54+ use_split_build :
55+ description : |
56+ [Experimental] Build a libtorch only wheel and build pytorch such that
57+ are built from the libtorch wheel.
58+ required : false
59+ type : boolean
60+ default : false
61+
62+ outputs :
63+ matrix :
64+ description : " Generated build matrix"
65+ value : ${{ jobs.generate.outputs.matrix }}
66+
67+ jobs :
68+ generate :
69+ outputs :
70+ matrix : ${{ steps.generate.outputs.matrix }}
71+ runs-on : ubuntu-latest
72+ steps :
73+ - uses : actions/setup-python@v5
74+ with :
75+ python-version : ' 3.10'
76+ - name : Checkout test-infra repository
77+ uses : actions/checkout@v4
78+ with :
79+ repository : ${{ inputs.test-infra-repository }}
80+ ref : ${{ inputs.test-infra-ref }}
81+ - uses : ./.github/actions/set-channel
82+ - name : Generate test matrix
83+ id : generate
84+ env :
85+ PACKAGE_TYPE : ${{ inputs.package-type }}
86+ OS : ${{ inputs.os }}
87+ CHANNEL : ${{ inputs.channel != '' && inputs.channel || env.CHANNEL }}
88+ WITH_CUDA : ${{ inputs.with-cuda }}
89+ WITH_ROCM : ${{ inputs.with-rocm }}
90+ WITH_CPU : ${{ inputs.with-cpu }}
91+ WITH_XPU : ${{ inputs.with-xpu }}
92+ # limit pull request builds to one version of python unless ciflow/binaries/all is applied to the workflow
93+ # should not affect builds that are from events that are not the pull_request event
94+ LIMIT_PR_BUILDS : ${{ github.event_name == 'pull_request' && !contains( github.event.pull_request.labels.*.name, 'ciflow/binaries/all') }}
95+ # This is used when testing release binaries only from download.pytorch.org.
96+ # In cases when pipy binaries are not published yet.
97+ USE_ONLY_DL_PYTORCH_ORG : ${{ inputs.use-only-dl-pytorch-org }}
98+ BUILD_PYTHON_ONLY : ${{ inputs.build-python-only }}
99+ USE_SPLIT_BUILD : ${{ inputs.use_split_build }}
100+ PYTHON_VERSIONS : ${{ inputs.python-versions }}
101+ run : |
102+ set -eou pipefail
103+ MATRIX_BLOB="$(python3 .github/scripts/generate_binary_build_matrix.py)"
104+ echo "${MATRIX_BLOB}"
105+ echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
106+
107+ concurrency :
108+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ inputs.package-type }}-${{ inputs.os }}-${{ inputs.test-infra-repository }}-${{ inputs.test-infra-ref }}
109+ cancel-in-progress : true
0 commit comments