-
Notifications
You must be signed in to change notification settings - Fork 279
Expand file tree
/
Copy pathbuild_portable_linux_python_packages.yml
More file actions
181 lines (170 loc) · 7.46 KB
/
Copy pathbuild_portable_linux_python_packages.yml
File metadata and controls
181 lines (170 loc) · 7.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
name: Build Portable Linux Python Packages
on:
workflow_dispatch:
inputs:
artifact_github_repo:
description: "GitHub repository for artifact_run_id"
type: string
default: ROCm/TheRock
artifact_run_id:
description: "artifact_run_id to download artifacts from"
type: string
default: "17865324892" # TODO: default to the most recent successful run (using a script)
artifact_group:
description: "artifact_group to build (e.g. 'gfx94X-dcgpu' for single family builds, 'multi-arch-release' for multi-arch builds with 'amdgpu_families' set)"
type: string
amdgpu_families:
description: "amdgpu_families for multi-arch builds as a semicolon-separated list (e.g. 'gfx94X-dcgpu;gfx120X-all'). Leave empty for single-family builds (those only use artifact_group)"
type: string
default: ""
linux_amdgpu_families:
description: "Linux side of the cross-platform family pair for multi-arch builds; used to advertise the union of device extras in the rocm sdist. Leave empty for single-platform builds."
type: string
default: ""
windows_amdgpu_families:
description: "Windows side of the cross-platform family pair. See linux_amdgpu_families."
type: string
default: ""
multiarch_index:
description: "Enable multi-arch indexing (generates per-family indexes)"
type: boolean
default: false
package_version:
description: "package_version to set on packages, e.g. '7.13.0.dev0+dbd7369489260265fc6ddfc9d0de1262a95fe974'"
type: string
release_type:
description: 'Release type: "ci" for CI, or "dev", "nightly", "prerelease".'
type: string
default: ""
repository:
description: "Repository to checkout. Defaults to github.repository."
type: string
default: ""
ref:
description: "Branch, tag, or SHA to checkout. Defaults to the triggering ref."
type: string
default: ""
workflow_call:
inputs:
artifact_github_repo:
type: string
artifact_run_id:
type: string
default: ""
artifact_group:
type: string
amdgpu_families:
type: string
default: ""
linux_amdgpu_families:
type: string
default: ""
windows_amdgpu_families:
type: string
default: ""
multiarch_index:
type: boolean
default: false
package_version:
type: string
release_type:
type: string
default: ci
repository:
description: "Repository to checkout. Defaults to github.repository."
type: string
default: ""
ref:
description: "Branch, tag, or SHA to checkout. Defaults to the triggering ref."
type: string
default: ""
outputs:
package_find_links_url:
description: URL for pip --find-links to install built packages
value: ${{ jobs.build_rocm_wheels.outputs.package_find_links_url }}
package_index_url:
description: URL for pip --index-url to install built packages (preferred for new builds)
value: ${{ jobs.build_rocm_wheels.outputs.package_index_url }}
kpack_split:
description: "true if this is a kpack-split flat build, false for legacy per-family"
value: ${{ jobs.build_rocm_wheels.outputs.kpack_split }}
permissions:
contents: read
run-name: Build portable Linux Python Packages (${{ inputs.artifact_group }}, ${{ inputs.package_version }})
jobs:
build_rocm_wheels:
name: Build Python | ${{ inputs.artifact_group }}
# Note: GitHub-hosted runners run out of disk space for some gpu families
runs-on: ${{ github.repository_owner == 'ROCm' && 'aws-linux-scale-rocm-prod' || 'ubuntu-24.04' }}
permissions:
id-token: write
container:
image: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:a382085df3ba2419b58aa9051350883a0d0b732a4bc0a4ef60458f8161bb08c6
options: -v /runner/config:/home/awsconfig/
outputs:
package_find_links_url: ${{ steps.upload.outputs.package_find_links_url }}
package_index_url: ${{ steps.upload.outputs.package_index_url }}
kpack_split: ${{ steps.upload.outputs.kpack_split }}
env:
AWS_SHARED_CREDENTIALS_FILE: /home/awsconfig/credentials.ini
ARTIFACT_RUN_ID: "${{ inputs.artifact_run_id != '' && inputs.artifact_run_id || github.run_id }}"
ARTIFACTS_DIR: "${{ github.workspace }}/artifacts"
PACKAGES_DIR: "${{ github.workspace }}/packages"
RELEASE_TYPE: ${{ inputs.release_type }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref }}
- name: Install Python requirements
run: pip install -r requirements.txt
- name: Fetch artifacts
run: |
if [ -n "${{ inputs.amdgpu_families }}" ]; then
# Multi-arch mode: use artifact_manager.py to fetch all families
echo "Fetching artifacts for multiple families: ${{ inputs.amdgpu_families }}"
python ./build_tools/artifact_manager.py fetch \
--run-id="${{ env.ARTIFACT_RUN_ID }}" \
--run-github-repo="${{ inputs.artifact_github_repo }}" \
--stage=all \
--amdgpu-families="${{ inputs.amdgpu_families }}" \
--expand-family-to-targets \
--output-dir="${{ github.workspace }}"
# NOTE: artifact_manager.py appends /artifacts to --output-dir
# in non-flatten mode, so pass workspace root here so that
# artifacts land in ARTIFACTS_DIR ($workspace/artifacts).
else
# Single-family mode: use fetch_artifacts.py (backward compatible)
echo "Fetching artifacts for single family: ${{ inputs.artifact_group }}"
python ./build_tools/fetch_artifacts.py \
--run-github-repo="${{ inputs.artifact_github_repo }}" \
--run-id="${{ env.ARTIFACT_RUN_ID }}" \
--artifact-group="${{ inputs.artifact_group }}" \
--output-dir="${{ env.ARTIFACTS_DIR }}"
fi
- name: Build Python packages
run: |
python ./build_tools/build_python_packages.py \
--artifact-dir="${{ env.ARTIFACTS_DIR }}" \
--dest-dir="${{ env.PACKAGES_DIR }}" \
--version="${{ inputs.package_version }}" \
--linux-amdgpu-families="${{ inputs.linux_amdgpu_families }}" \
--windows-amdgpu-families="${{ inputs.windows_amdgpu_families }}"
- name: Configure AWS Credentials
uses: ./.github/actions/configure_aws_artifacts_credentials
with:
release_type: ${{ inputs.release_type }}
# NOTE: we use `github.run_id` and NOT `env.ARTIFACT_RUN_ID` here!
# This ensures that if they are different we _download_ artifacts from the
# input run's subdirectory and _upload_ to our current run's subdirectory.
- name: Upload Python packages
id: upload
run: |
python build_tools/github_actions/upload_python_packages.py \
--input-packages-dir="${{ env.PACKAGES_DIR }}" \
--artifact-group="${{ inputs.artifact_group }}" \
--run-id="${{ github.run_id }}" \
${{ inputs.multiarch_index && '--multiarch' || '' }}