Repository navigation
Expand file tree
/
Copy pathmulti_arch_build_windows_artifacts.yml
More file actions
295 lines (265 loc) · 11.4 KB
/
Copy pathmulti_arch_build_windows_artifacts.yml
File metadata and controls
295 lines (265 loc) · 11.4 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
# Reusable Workflow: Build Stage Artifacts
#
# This workflow builds TheRock stage artifacts for all stages.
# Handles both generic stages (compiler-runtime, etc.) and
# per-arch stages (math-libs) using conditional logic.
#
# Artifacts flow between stages via S3 using the artifact_manager.py tool.
#
# TODO: When kpack splitting is permanently enabled, change fetch commands to use
# --generic-only instead of --amdgpu-families for efficiency. Subsequent build
# stages only need generic (host) artifacts; device-specific kpacks are not
# needed until final packaging.
name: Build Stage Artifacts
on:
workflow_call:
inputs:
stage_name:
type: string
required: true
description: "Stage name (e.g., compiler-runtime, math-libs)"
stage_display_name:
type: string
required: true
description: "Human-readable display name for the job"
timeout_minutes:
type: number
required: true
description: "Job timeout in minutes"
amdgpu_family:
type: string
required: false
default: ""
description: "GPU family for per-arch stages (empty for generic stages)"
dist_amdgpu_families:
type: string
required: true
description: "Semicolon-separated list of all GPU families for dist targets"
build_variant_cmake_preset:
type: string
rocm_package_version:
type: string
required: true
description: "ROCm package version string"
release_type:
description: 'Release type; controls artifact bucket and IAM role'
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: ""
build_runs_on_large:
description: "Build runner label (selected by configure script with weighted distribution)"
type: string
default: "az-windows-scale-rocm-default-prod"
external_repo_config:
description: "JSON source identity and build options generated by detect_external_repo_config.py"
type: string
default: ""
rebuild_artifacts:
description: "Comma-separated artifact names to build (granular reuse). Empty = build all artifacts in stage."
type: string
default: ""
quartz_tracking_id:
type: string
default: ""
permissions:
contents: read
jobs:
build_stage:
name: ${{ inputs.stage_display_name }}
runs-on: ${{ inputs.build_runs_on_large }}
timeout-minutes: ${{ inputs.timeout_minutes }}
outputs:
summary: ${{ steps.summary.outputs.summary }}
permissions:
contents: read
id-token: write
defaults:
run:
shell: bash
env:
QUARTZ_REPORTING_WORKFLOW: multi_arch_build_windows_artifacts.yml
QUARTZ_WORKFLOW_POSTFIX: "- build ROCm artifacts"
DIST_AMDGPU_FAMILIES: ${{ inputs.dist_amdgpu_families }}
AMDGPU_FAMILIES: ${{ inputs.amdgpu_family }}
ROCM_PACKAGE_VERSION: ${{ inputs.rocm_package_version }}
RELEASE_TYPE: ${{ inputs.release_type }}
REBUILD_ARTIFACTS: ${{ inputs.rebuild_artifacts }}
STAGE_NAME: ${{ inputs.stage_name }}
CCACHE_CONFIGPATH: ${{ github.workspace }}/.ccache/ccache.conf
TEATIME_FORCE_INTERACTIVE: 0
EXTERNAL_REPO_CONFIG: ${{ inputs.external_repo_config }}
BUILD_DIR: B:\build
CACHE_DIR: ${{ github.workspace }}/.cache
steps:
- name: "Quartz - started ${{ env.QUARTZ_WORKFLOW_POSTFIX }}"
continue-on-error: true
if: ${{ vars.NOTIFY_QUARTZ_ENABLED == 'true' }}
uses: ROCm/Quartz/.github/actions/notify_quartz@2d3d15630651544b1469f71da25da9b73ffa8667 # notify_quartz/v1.1.3
with:
run_phase: started
reporting_workflow: ${{ env.QUARTZ_REPORTING_WORKFLOW }}
workflow_inputs: ${{ toJSON(inputs) }}
gh_app_client_id: ${{ secrets.GH_APP_HAULY_CID }}
gh_app_private_key: ${{ secrets.GH_APP_HAULY_PRIVATE_KEY }}
# Enable git longpaths before checkout (needed for external repos with long paths)
- name: Enable git longpaths
if: ${{ inputs.external_repo_config != '' }}
run: git config --system core.longpaths true
- name: Checkout TheRock
timeout-minutes: 10
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref }}
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.12"
- name: Install python deps
run: pip install -r requirements.txt
- name: Install requirements
run: |
choco source disable -n=chocolatey
choco source add -n=internal -s http://nexus-service.nexus-ns.svc.cluster.local:8081/repository/choco-group/ --priority=1
choco install --no-progress -y ccache
choco install --no-progress -y ninja --version 1.13.2
choco install --no-progress -y strawberryperl
# win_flex/win_bison are required by the amd-mesa (libva/d3d12) build.
if [[ "${STAGE_NAME}" == "media-libs" ]]; then
choco install --no-progress -y winflexbison3
fi
echo "$PATH;C:\Strawberry\c\bin" >> $GITHUB_PATH
- uses: iterative/setup-dvc@6c05772f52d19792ed73aedb6c2bf65ec92adebb # v3.0.0
with:
version: '3.62.0'
# After other installs, so MSVC gets priority in the PATH.
- name: Configure MSVC
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: Adjust git config
run: |
git config --global core.symlinks true
git config --global core.longpaths true
git config fetch.parallel 10
- name: Runner health status
run: |
python build_tools/health_status.py
- name: Setup ccache
run: |
python ./build_tools/setup_ccache.py \
--release-type "${RELEASE_TYPE}" \
--dir "$(dirname $CCACHE_CONFIGPATH)" \
--local-path "$CACHE_DIR/ccache" \
--log-dir "${BUILD_DIR}/logs/ccache"
# Note: no AWS credentials should be needed here since our CI buckets
# all currently have public read access.
- name: Fetch inbound artifacts
run: |
python build_tools/artifact_manager.py fetch \
--run-id="${{ github.run_id }}" \
--stage="${STAGE_NAME}" \
--amdgpu-families="${AMDGPU_FAMILIES}" \
--output-dir="${BUILD_DIR}" \
--bootstrap
- name: Fetch submodules with fetch_sources.py
timeout-minutes: 30
env:
GH_TOKEN: ${{ github.token }}
run: |
gh auth setup-git --hostname github.com
python build_tools/fetch_sources.py --stage ${STAGE_NAME} --jobs 12 --depth 1
- name: Get stage configuration
id: stage_config
run: |
python build_tools/configure_stage.py \
--stage=${STAGE_NAME} \
--artifacts="${REBUILD_ARTIFACTS}" \
--amdgpu-families="${AMDGPU_FAMILIES}" \
--dist-amdgpu-families="${DIST_AMDGPU_FAMILIES}" \
--gha-output
- name: Install stage python deps
if: ${{ steps.stage_config.outputs.pip_install_cmd }}
# configure_stage.py emits argument fragments from repository build configuration.
# Trust that configuration as executable build input; multiple arguments are intentional.
run: | # zizmor: ignore[template-injection]
pip install ${{ steps.stage_config.outputs.pip_install_cmd }}
- name: Configure
# configure_stage.py emits argument fragments from repository build configuration.
# Trust that configuration and the caller-provided preset/external repo options
# as executable build inputs; their shell quoting and multiple arguments are intentional.
run: | # zizmor: ignore[template-injection]
cmake -B "${BUILD_DIR}" -S . -GNinja \
--preset=${{ inputs.build_variant_cmake_preset }} \
-DTHEROCK_PACKAGE_VERSION="${ROCM_PACKAGE_VERSION}" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_HIP_COMPILER_LAUNCHER=ccache \
${{ inputs.external_repo_config != '' && fromJSON(inputs.external_repo_config).extra_cmake_options || '' }} \
${{ steps.stage_config.outputs.cmake_args }}
- name: Build stage
run: |
cmake --build "${BUILD_DIR}" --target stage-${STAGE_NAME} therock-artifacts -- -k 0
- name: Run build tests (Comgr, blocking)
if: ${{ !cancelled() && inputs.stage_name == 'compiler-runtime' }}
env:
TEATIME_FORCE_INTERACTIVE: 1
run: |
cmake --build "${BUILD_DIR}" --target therock-build-tests -- -k 0
- name: Report
if: ${{ !cancelled() }}
run: |
echo "CCache Stats:"
ccache -s -v
echo "Artifacts:"
ls -lh "${BUILD_DIR}"/artifacts/*.tar.xz 2>/dev/null || echo "No artifacts found"
- name: Test Packaging
run: |
ctest --test-dir ${BUILD_DIR} --output-on-failure
- name: Configure AWS credentials for artifact uploads
if: ${{ always() }}
uses: ./.github/actions/configure_aws_artifacts_credentials
with:
release_type: ${{ inputs.release_type }}
# TODO(#3336): Attempt upload `always()`?
# * If some part of the build failed, partial artifacts may be useful for debugging.
# * This script fails if `build_dir / "artifacts"` does not exist. That's useful
# if the build succeeded but did not produce artifacts. That's _not_ useful
# if the workflow failed or was cancelled before the build even started though.
- name: Push stage artifacts
run: |
python build_tools/artifact_manager.py push \
--run-id ${{ github.run_id }} \
--stage="${STAGE_NAME}" \
--build-dir="${BUILD_DIR}"
- name: Upload stage logs
if: ${{ always() }}
run: |
python build_tools/github_actions/post_stage_upload.py \
--run-id=${{ github.run_id }} \
--stage="${STAGE_NAME}" \
--build-dir="${BUILD_DIR}" \
--amdgpu-family="${AMDGPU_FAMILIES}"
- name: Capture job summary
id: summary
if: always()
run: python build_tools/github_actions/capture_job_summary.py
- name: "Quartz - completed ${{ env.QUARTZ_WORKFLOW_POSTFIX }}"
continue-on-error: true
if: ${{ always() && vars.NOTIFY_QUARTZ_ENABLED == 'true' }}
uses: ROCm/Quartz/.github/actions/notify_quartz@2d3d15630651544b1469f71da25da9b73ffa8667 # notify_quartz/v1.1.3
with:
run_phase: completed
run_conclusion: ${{ job.status }}
reporting_workflow: ${{ env.QUARTZ_REPORTING_WORKFLOW }}
workflow_inputs: ${{ toJSON(inputs) }}
workflow_step_outputs: ${{ toJSON(steps) }}
gh_app_client_id: ${{ secrets.GH_APP_HAULY_CID }}
gh_app_private_key: ${{ secrets.GH_APP_HAULY_PRIVATE_KEY }}